cmake invalid numeric argument '/Wextra'

前端 未结 1 626
傲寒
傲寒 2020-12-16 14:13

Windows XP Pro 32bit

Visual studio 2008 VC Express edition.

I have installed cmake and created the CMakeLists.txt and I want to cross-platform for Linux/wind

相关标签:
1条回答
  • 2020-12-16 14:49

    Your CMakeLists.txt defines compile flag -Wextra for GCC and then CMake tried to use that on cl (the Microsoft compiler) too. Fix the CMakeLists.txt so that it tests for compiler before setting warning flags, i.e.

    # Set default compile flags for GCC
    if(CMAKE_COMPILER_IS_GNUCXX)
        message(STATUS "GCC detected, adding compile flags")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -pedantic -Wall -Wextra")
    endif(CMAKE_COMPILER_IS_GNUCXX)
    
    0 讨论(0)
提交回复
热议问题