Questions tagged [cmake-cache]

4 questions
4
votes
1 answer

How to use CMake cached variables inside subprocess called by custom target?

My project contains a custom target which generates some output via .cmake script. It looks like this: add_custom_target(TargetName COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/script.cmake BYPRODUCTS…
1
vote
1 answer

Easier/terser mechanism for translating CMake option into preprocessor definitions?

I find myself repeating the following segment of code in my CMakeLists.txt: option(SOME_OPT "Some option" ON) if (SOME_OPT) target_compile_definitions(my_app SOME_IDENTIFIER_HERE_RELATED_TO_OPT) endif() (and occasionally something similar but…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
0
votes
1 answer

At which exact point is CMakeCache.txt created?

cmake set value of variable for first run after command "project" prompted the present OP. From the tests mentioned there, and others, I guess that on first run CMakeCache.txt is created when executing command project. Could someone confirm/correct,…
0
votes
1 answer

CMake: print root project name using cmake commandline

Is it possible to print project name value of a CMake project using cmake.exe? for example: cmake -LA CMakeLists.txt | grep CMAKE_INSTALL_PREFIX to get the install prefix configured for the project. Is there any way similar to get…
Raaam
  • 95
  • 11