[CMake] shell level access to values of cmake variables
Johannes Zarl
johannes.zarl at jku.at
Wed Dec 21 02:27:56 EST 2011
Am Thursday, 10. November 2011, 18:48:06 schrieb vagn scott:
> is there something like
> cmake --dump-var PROJECT_NAME
> that would output the string
> hello_foo_baz
As far as I know CMake doesn't do this out of the box. As long as you have a
configured build tree and only want to access cache variables, you could use
the script mode.
Create a script named "printvar.cmake" with the following command:
message(${${VAR}})
Then you can do this in the build directory:
cmake . -DVAR=CMAKE_PROJECT_NAME -P ../printvar.cmake
Be aware, though, that the message is printed to stderr, not stdout. Other
than that (and the issue that it is a dirty hack), this should do what you
need...
Cheers,
Johannes
More information about the CMake
mailing list