[CMake] remove compile flag with set_source_file_properties

Florian Reinhard florian.reinhard at googlemail.com
Wed Aug 17 04:55:51 EDT 2011


Hi!

My cmake project (using the texas instruments cl6x compiler) contains
two configurations, release and debug:


set(CMAKE_C_FLAGS           "-whatever -flags")
set(CMAKE_CXX_FLAGS         ${CMAKE_C_FLAGS})


set(CMAKE_C_FLAGS_DEBUG     "-g  -d\"_DEBUG\" ")
set(CMAKE_C_FLAGS_RELEASE   "-O3")
set(CMAKE_CXX_FLAGS_DEBUG   ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})

but for some files, even when using the debug configuration, i'd need
to remove the "-g" for some files. Is there some way to get this done?

using

SET_SOURCE_FILES_PROPERTIES( ${LIST_OF_FILES} PROPERTIES COMPILE_FLAGS "-O3")

would add -O3 again no matter what configuration, which would be fine,
but i couldn't find out how to set per file C(XX)_FLAGS_DEBUG so i'd
be able to remove the -g

Is this somehow possible?

Thank you and kind regards,

Florian Reinhard


More information about the CMake mailing list