[CMake] preprocessor def

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri Feb 15 16:58:33 EST 2008


On 2008-02-15 21:31-0000 Harsha Sri-Narayana wrote:

> 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.

Try COMPILE_FLAGS "-DUSE_GLEW".  Also, use make VERBOSE=1 to see the
actual compilation flags that are being used in the build.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list