[CMake] calling c-compiler by hand

Jochen Wilhelmy j.wilhelmy at arcor.de
Mon Jul 12 10:14:00 EDT 2010


Hi!

I'd like to call the c-compiler by hand as pre-link step to compile in 
the current svn version.

on windows i first separate the arguments

separate_arguments(CFLAGS WINDOWS_COMMAND "${CMAKE_CXX_FLAGS} 
${CMAKE_CXX_FLAGS_DEBUG} /c")

and then I do

add_custom_command(TARGET MyProject PRE_LINK
     COMMAND ${CMAKE_CXX_COMPILER} ${CFLAGS} 
"${CMAKE_CURRENT_SOURCE_DIR}/VersionInfo.cpp"
     VERBATIM
)

Now the problem: currently CMAKE_CXX_FLAGS_DEBUG is hard-coded. how can 
i substitute it
with the current configuration? If it is release then the contents of 
CMAKE_CXX_FLAGS_RELEASE should
be taken.

-Jochen



More information about the CMake mailing list