[CMake] preprocessor def

Harsha Sri-Narayana h.sri-narayana at cs.ucl.ac.uk
Fri Feb 15 16:31:48 EST 2008


I have this code in a cpp file

#ifdef USE_GLEW
#include <GL/glew.h>
#endif


I have this in a cmakelists.txt file:

SET_TARGET_PROPERTIES(rtf PROPERTIES
LINKER_LANGUAGE CXX
COMPILE_FLAGS "USE_GLEW"
)


This doesn't work, couldn't anyone show me what I've done wrong?  In the 
documentation it says, "The COMPILE_FLAGS property sets additional 
compiler flags used to build sources within the target. It may also be 
used to pass additional preprocessor definitions." [1]  I am allowed to 
change the cpp source code if that's the best solution, but I would 
rather a solution could be found from within the cmakelists.txt file.

Any help would be greatly appreciated, and thanks for reading.
-Harsha

[1] http://www.cmake.org/HTML/Documentation.html


More information about the CMake mailing list