Why are you trying to do this before the project command? You can set the target name to be something different from the project name, and you can even set the output name of the executable/library to be different than what would be automatically set by default from the target name. (I've done this, to embed the platform into the code and/or output name)
My guess: you've done a lot of work with makefiles and the C preprocessor. It looks like you're overthinking it - CMake is a reasonably high-level scripting language, not a macro language or preprocessor. Could you share a high-level intended behavior with the list so we might be able to give you a more satisfying answer? Ryan On Thu, Sep 16, 2010 at 6:46 PM, J Decker <d3c...@gmail.com> wrote: > I want to define a variablle that I can use later to pass the string > program name or library name so I have something lke... > > # have to compare generator because MINGW and CMAKE_COMPILER_IS_GNUCC > are not defined yet... > # would also like to use a more general idea like compier is GCC... > if(CMAKE_GENERATOR MATCHES "MinGW Makefiles") > SET( DEFINE_STRING_QUOTE_OPEN "\"\\\"" ) > SET( DEFINE_STRING_QUOTE_CLOSE "\\\"\"" ) > endif( CMAKE_GENERATOR MATCHES "MinGW Makefiles") > > > SET( PROGRAM_NAME > > ${DEFINE_STRING_QUOTE_OPEN}${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}${DEFINE_STRING_QUOTE_CLOSE}) > SET( LIBRARY_NAME > > ${DEFINE_STRING_QUOTE_OPEN}${CMAKE_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_LIBRARY_SUFFIX}${DEFINE_STRING_QUOTE_CLOSE}) > > but when I use these, the substitution was done at the time the SET > happened instead of later when it is referenced... can I add \'s to > escape the dollars or something to delay expansion until it is used? > Macros can't be used for this sort of thing, right? > > later when I do > SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES > COMPILE_FLAGS "-DTARGETNAME=${PROGRAM_NAME}" > ) > > TARGETNAME="\"\"" > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake > -- Ryan Pavlik HCI Graduate Student Virtual Reality Applications Center Iowa State University rpav...@iastate.edu http://academic.cleardefinition.com Internal VRAC/HCI Site: http://tinyurl.com/rpavlik
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake