Hi cmake users: I am trying to use cmake to define a symbol so that I can use the #if syntax in C++. I have read the documentation for the SET_TARGET_PROPERTIES command and it seems to me that there is a property called DEFINE_SYMBOL which sets "... a symbol that is defined when compiling C or C++ sources" (http://www.cmake.org/HTML/Documentation.html). However, when I use this property it does not define the symbol. I am using CMake v2.2.3 with Microsoft Visual Studio 7 .NET 2003 on a Win32 machine. FYI I can get the LINK_FLAGS property to work, but not the DEFINE_SYMBOL... Have I misunderstood something? Am I setting the property correctly? Any help would be appreciated. My cmake file and source is below: Start CMakeLists.txt ==================================================== # Add Project PROJECT(TestMain) # Setup output paths SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin CACHE PATH "Single output directory for building all libraries." FORCE) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin CACHE PATH "Single output directory for building all executables." FORCE) # Add Executable ADD_EXECUTABLE(TestMain TestMain.cxx) SET_TARGET_PROPERTIES(TestMain PROPERTIES DEFINE_SYMBOL "MY_SYMBOL") TARGET_LINK_LIBRARIES(TestMain TestMain) End CMakeLists.txt ==================================================== Start TestMain.cxx ==================================================== #include <iostream> int main(int argc, char * argv[]) { #if (MY_SYMBOL) std::cout << "MY_SYMBOL was defined." << std::endl; #else std::cout << "MY_SYMBOL was NOT defined." << std::endl; #endif } End TestMain.cxx ==================================================== NOTE: TestMain.exe prints "MY_SYMBOL was NOT defined." Regards, Dan [[EMAIL PROTECTED]] |
_______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake