[CMake] Finding out what a preprocessor macro is defined as
Alexander Neundorf
a.neundorf-work at gmx.net
Sun Dec 30 11:29:00 EST 2007
On Saturday 29 December 2007, Matt Williams wrote:
> 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?
Maybe something like
include(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES()
with a C file something like:
#include "../include/PlatformInformation.h"
#ifdef _WHAT_YOU_ARE_INTERESTED_IN
#error "this is defined"
#endif
Alex
More information about the CMake
mailing list