If your variables are marked as INTERNAL or not CACHE'd at all, then there is no method within CMake to pull it out. And it will not show any that are cached INTERNAL, and will only show ADVANCED if -LA is used instead of -L. The issue though is that it will not show any variables that are not marked with CACHE. So, it does show variables from other files. Build files have been written to: /home/tgallagher/cmaketest-build Check for working CXX compiler: /usr/bin/c++ - works Check for working CXX compiler: /usr/bin/c++ Check for working C compiler: /usr/bin/gcc - works Check for working C compiler: /usr/bin/gcc Gives: - The C compiler identification is GNU The command (run from another directory): cmake -L. Of course, if you only want the value, you can do: cmake -L /path/to/CMakeLists.txt | grep MY_CMAKE_VARIABLE | cut -d "=" -f2įor example, with a CMakeLists.txt that is: cmake_minimum_required(VERSION 2.8)Īnd where otherFile.txt is: set(MY_OTHER_VAR "Hi" CACHE STRING "") If it is an advanced variable, add the -A flag to the same command and it will include advanced variables. Which will return to you something like := If you do not yet have a cache file and you want to see what options there are in a CMakeLists.txt file, you can do (in a different directory since this will write a cache file): cmake -L /path/to/CMakeLists.txt | grep MY_CMAKE_VARIABLE If you have an existing cache file, you can do: grep MY_CMAKE_VARIABLE CMakeCache.txt
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |