How can I add a minimum compiler version requisite?

后端 未结 3 2106
無奈伤痛
無奈伤痛 2020-12-13 18:57

I want to create a project in C++11 and I use CMake as my build system.

How can I add a minimum compiler version requisite in the CMake config files?

3条回答
  •  余生分开走
    2020-12-13 19:30

    You can check the specific gcc version as follows:

    if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
        message(FATAL_ERROR "Require at least gcc-5.1")
    endif()
    

提交回复
热议问题