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

Reply via email to