CMAKE_CURRENT_LIST_DIR — CMake 3.23.0-rc3 Documentation
cmake.org › variable › CMAKE_CURRENT_LIST_DIRAs CMake processes the listfiles in your project this variable will always be set to the directory where the listfile which is currently being processed ( CMAKE_CURRENT_LIST_FILE) is located. The value has dynamic scope. When CMake starts processing commands in a source file it sets this variable to the directory where this file is located. When CMake finishes processing commands from the file it restores the previous value.
list — CMake 3.23.0-rc4 Documentation
cmake.org › cmake › helpA list in cmake is a ; separated group of strings. To create a list the set command can be used. For example, set (var a b c d e) creates a list with a;b;c;d;e, and set (var "a b c d e") creates a string or a list with one item in it. (Note macro arguments are not variables, and therefore cannot be used in LIST commands.)
List of variables in CMake - Stack Overflow
stackoverflow.com › questions › 31450133Jul 16, 2015 · Ideally, there would be a way to create a meta-variable that holds a list of variables that I want to pass to the function. Then, I could add mylib_LIBRARIES only in certain cases. Pseudo code: include (FindPackageHandleStandardArgs) # create empty list list (APPEND mylib_LIBRARIES "") # the bar variable is always used meta_list (APPEND METALIST bar) # in some cases add the used variable mylib_LIBRARIES to the METALIST if (A) list (APPEND mylib_LIBRARIES "foo") meta_list (APPEND METALIST ...