Applying flags in CMake environment
I am a newbie to cmake. I want to add a new flag to be applied for my module build which uses cmake as build tool. Am trying to add the flag in CMakeLists.txt but the changes are not reflec开发者_运维问答ted. Should I apply the changes to some other file? I tried cleaning using $ cmake clean . but still the problem exists.
Request help.
Regards Santosh
If you mean compiler flags then you can do something like below, note I am a newbie too so there might well be better ways:
if( MSVC )
set( CMAKE_CXX_FLAGS " /DWIN32 /W3 /GX /GR /Wp64 /Zc:forScope" )
set( CMAKE_CXX_FLAGS_DEBUG " /D_DEBUG /MDd /Zi /Ob0 /Od /GZ /Gm /RTC1 /ZI" )
elseif( CMAKE_COMPILER_IS_GNUCXX )
set( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -ansi -Winvalid-pch" )
endif()
精彩评论