[CMake] #cmakedefine vs #define

Balamurali Ananthan bala at txcorp.com
Tue Mar 15 18:26:31 EDT 2011


Hello,

Sorry if this question is too primitive. I am trying to extract the 
build dir into the source code by populating it in a variable in my 
config.h file.

I do this by adding the following line in config.h.in

#cmakedefine PROJ_BUILD_DIR_CMAKEDEFINE "${PROJECT_BINARY_DIR}"

In the config.h, this produces

/* #undef PROJ_BUILD_DIR_CMAKEDEFINE */



But if i replace it to this in config.h.in,

#define PROJ_BUILD_DIR_DEFINE "${PROJECT_BINARY_DIR}"

Then the right value is populated in the config.h

#define PROJ_BUILD_DIR_DEFINE "/home/bala/projects/myproj/trunk/builds"

Wondering why didn't the cmakedefine work in this case? Any clues?

Thanks much.

-- 
Balamurali Ananthan



More information about the CMake mailing list