[CMake] Finding out what a preprocessor macro is defined as

Matt Williams lists at milliams.com
Sat Dec 29 10:20:11 EST 2007


Hi,

I am writing a cmake system for a project, but at one point I need to decide 
whether a certain module of it should be built or not. Now, there's some 
preprocessor logic in one of the header files which sets a preprocessor 
#define to 1 or 0 and that is used to decide whether to include the header 
files for this module.

What I was hoping would be possible is for me to be able to run a cmake macro, 
something like 
INSPECT_CPP_MACRO(_BUILD_MODULE_ "../include/PlatformInformation.h" 
BUILD_MODULE) which would compile and run the header file and put the value 
of _BUILD_MODULE_ into BUILD_MODULE.

Is this possible, is there a macro that can do this, or can anyone give a 
suggestion as to how I could write one?

Regards,
Matt Williams


More information about the CMake mailing list