How to get CMake to set the Visual Studio linker option. Create Debug Info How Yes?

I am using CMake to create a Visual Studio project. In my release of the release, I also want to set the Visual Studio project property one as Yes, which is the properties ==> Configuration Properties ==> Linker ==> Debug ==> Generate debug information.

Is it possible?

+4
source share
1 answer

You can add custom linker options using the LINK_FLAGStarget property:

add_executable(foo ${FOO_SOURCES})
if(MSVC)
    set_property(TARGET foo APPEND PROPERTY LINK_FLAGS /DEBUG)
endif()

This sets the flag /DEBUGfor all configurations in Visual Studio assemblies. It is also possible to add a flag only for a particular configuration .

, . , . , , .

+4

All Articles