[CMake] global variable passing up via INTERNAL cache
Tal Blum
tblum at bbn.com
Thu Nov 29 18:17:38 EST 2007
I only use one variable and I define 2 macros. The second macro is used to
initialize the list before I call APPEND_INTERNAL_LIST(). Notice that I do
not use a temp variable that is shared between calls and can cause problems.
# A macro for passing lists between different directories
# through an internal cache variable.
MACRO (APPEND_INTERNAL_LIST LIST_NAME VALUE)
# If the list in not in the cache, create it.
IF (${LIST_NAME})
SET (${LIST_NAME} "${${LIST_NAME}};${VALUE}" CACHE INTERNAL "Internal
variable")
ELSE (${LIST_NAME})
SET (${LIST_NAME} "${VALUE}" CACHE INTERNAL "Internal variable")
ENDIF (${LIST_NAME})
ENDMACRO (APPEND_INTERNAL_LIST)
# A macro for passing lists between different directories
# through an internal cache variable.
# This function empties the variable (usually because of older runs)
MACRO (INITIALIZE_INTERNAL_LIST LIST_NAME)
SET (${LIST_NAME} "" CACHE INTERNAL "Internal variable")
ENDMACRO (INITIALIZE_INTERNAL_LIST)
-Tal
More information about the CMake
mailing list