summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-13 08:00:12 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-13 08:00:12 +0100
commitdc83a553b2d3149fbf5e9d47495a5438cce8810d (patch)
tree0eb76d1901a2254969397c1b09b5bd91df96be1d /CMakeLists.txt
parentfdff8f8c393afac807c5372da7f9365d8080f4cf (diff)
read userconfig filename from the cmake cache
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 12 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bcefcd6b..fe7f57a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,17 +66,20 @@ function(fm_run_hook str)
endfunction()
function(fm_load_userconfig)
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
- set(_fm_username "$ENV{USERNAME}")
- else()
- set(_fm_username "$ENV{USER}")
+ if(NOT DEFINED FLOORMAT_USERCONFIG)
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(_fm_username "$ENV{USERNAME}")
+ else()
+ set(_fm_username "$ENV{USER}")
+ endif()
+ sets(FILEPATH FLOORMAT_USERCONFIG "${CMAKE_CURRENT_SOURCE_DIR}/userconfig-${_fm_username}@${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}.cmake")
endif()
- set(_fm_userconfig "userconfig-${_fm_username}@${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}.cmake")
- if(EXISTS "${CMAKE_SOURCE_DIR}/${_fm_userconfig}")
- message(STATUS "Loading user config '${_fm_userconfig}'")
- include("${CMAKE_SOURCE_DIR}/${_fm_userconfig}" NO_POLICY_SCOPE)
+ if(EXISTS "${FLOORMAT_USERCONFIG}")
+ get_filename_component(__fm_userconfig_basename "${FLOORMAT_USERCONFIG}" NAME)
+ message(STATUS "Loading user config '${__fm_userconfig_basename}'")
+ include("${FLOORMAT_USERCONFIG}" NO_POLICY_SCOPE)
else()
- message(STATUS "Can't find user config '${_fm_userconfig}'")
+ message(STATUS "Can't find user config '${FLOORMAT_USERCONFIG}'")
endif()
endfunction()