To increase @doqtor's correct answer, you have several options. Or install on a global scale that applies these flags to all assembly types: CMAKE_CXX_FLAGS
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()
or for finer-grained control, use along with the generator expression to apply flags for each target: target_compile_options
target_compile_options(example_target PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/Zi>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-g>
)
CMake 3.2.2, CMake, " ". , - , , CMake.
, , ; MSVC Z7, Zi Zi - ?