Changing CMAKE_CXX_FLAGS in project

后端 未结 10 716
一个人的身影
一个人的身影 2020-12-08 10:05

I have the following content in my CMakeLists.txt:

project( Matfile )

SET ( CMAKE_CXX_FLAGS \"-std=c++0x\" )

set ( SOURCES
      \"foo.cpp\"
      \"bar.cp         


        
10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 10:28

    This is the solution I currently use:

    if(CMAKE_COMPILER_IS_GNUCXX)
        add_definitions(-std=c++0x)
        add_definitions(-std=gnu++11)
    endif()
    

    Or, if you have an older version of cmake and you want to see it show up in cmake-gui:

    set_property(CACHE CMAKE_CXX_FLAGS PROPERTY VALUE "-std=c++0x")
    

提交回复
热议问题