summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-06-17 20:31:31 +0000
committersleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2012-06-17 20:31:31 +0000
commit65beb56d0f6f37a64e1128ed26fb65d39254dfbf (patch)
tree2c52621c50ee67ddd4f9d9261eb38b151a06f751
parentd0f425fd0583d4b6dd3505770843cdb792688fe0 (diff)
downloadnavit-65beb56d0f6f37a64e1128ed26fb65d39254dfbf.tar.gz
Fix:build:Turn feature flag variables into CMake cache vars, to expose them for tools like ccmake.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5150 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--cmake/navit_macros.cmake33
1 files changed, 21 insertions, 12 deletions
diff --git a/cmake/navit_macros.cmake b/cmake/navit_macros.cmake
index a358b6bd0..0aafd44a1 100644
--- a/cmake/navit_macros.cmake
+++ b/cmake/navit_macros.cmake
@@ -1,48 +1,57 @@
-macro(internal_set VARIABLE REASON)
- if (NOT DEFINED ${VARIABLE})
- set(${VARIABLE} ${ARGN})
- set(${VARIABLE}_REASON ${REASON} CACHE STRING "reason")
+macro(set_feature_switch_default VARIABLE REASON ENABLE)
+ if ((NOT DEFINED ${VARIABLE}) # variable not in cache (first run)
+ OR ((DEFINED ${VARIABLE}_ORIGINAL) AND # variable in cache -> check for change
+ ((${VARIABLE}_ORIGINAL AND ${VARIABLE}) OR # poor man's boolean equal
+ (NOT ${VARIABLE}_ORIGINAL AND NOT ${VARIABLE}))))
+ set(${VARIABLE}_REASON ${REASON})
+ set(${VARIABLE} ${ENABLE} CACHE BOOL "feature switch")
else()
- set(${VARIABLE}_REASON "User defined" CACHE STRING "reason")
+ set(${VARIABLE}_REASON "User defined")
endif()
+ set(${VARIABLE}_ORIGINAL ${ENABLE} CACHE INTERNAL "original value set by build script")
endmacro()
macro(set_with_reason VARIABLE REASON ENABLE)
if (DEFINED ${VARIABLE}_REASON AND NOT ${VARIABLE}_REASON STREQUAL "User defined")
- set(${VARIABLE} ${ENABLE})
+ set(${VARIABLE} ${ENABLE} CACHE BOOL "feature switch" FORCE)
+ set(${VARIABLE}_ORIGINAL ${ENABLE} CACHE INTERNAL "original value set by build script")
set(${VARIABLE}_REASON ${REASON})
string(REPLACE "/" "_" VARIABLE_NAMES ${VARIABLE})
set(${VARIABLE_NAMES}_LIBS ${ARGN})
else()
- message("Do not change user defined settings for ${VARIABLE}")
+ message(WARNING "Do not change user defined settings for ${VARIABLE}")
endif()
endmacro()
macro(add_feature FEATURE REASON ENABLE)
list(APPEND ALL_FEATURES ${FEATURE})
- internal_set(${FEATURE} ${REASON} ${ENABLE})
+ set_feature_switch_default(${FEATURE} ${REASON} ${ENABLE})
endmacro()
macro(cfg_feature FEATURE REASON ENABLE)
set(${FEATURE} ${ENABLE})
- set(${FEATURE}_REASON ${REASON})
+ if (${FEATURE}_REASON STREQUAL "User defined")
+ set(${FEATURE}_REASON "${REASON} *user setting overridden*")
+ else()
+ set(${FEATURE}_REASON ${REASON})
+ endif()
endmacro()
macro(add_module MODULE_PATH REASON ENABLE)
list(APPEND ALL_MODULES ${MODULE_PATH})
- internal_set(${MODULE_PATH} ${REASON} ${ENABLE})
+ set_feature_switch_default(${MODULE_PATH} ${REASON} ${ENABLE})
endmacro()
# plugins are always linked static
macro(add_plugin PLUGIN_PATH REASON ENABLE)
list(APPEND ALL_PLUGINS ${PLUGIN_PATH})
- internal_set(${PLUGIN_PATH} ${REASON} ${ENABLE})
+ set_feature_switch_default(${PLUGIN_PATH} ${REASON} ${ENABLE})
endmacro()
# module plugins are always linked static
macro(add_module_plugin PLUGIN_PATH REASON ENABLE)
list(APPEND ALL_MODULE_PLUGINS ${PLUGIN_PATH})
- internal_set(${PLUGIN_PATH} ${REASON} ${ENABLE})
+ set_feature_switch_default(${PLUGIN_PATH} ${REASON} ${ENABLE})
endmacro()
macro(module_add_library MODULE_NAME )