【发布时间】:2018-02-20 23:09:17
【问题描述】:
这有什么问题:
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
add_compile_options("$<$<CONFIG:RELEASE>:-W -Wall -O3 -pedantic>")
add_compile_options("$<$<CONFIG:DEBUG>:-W -Wall -O0 -g -pedantic>")
endif()
我明白了:
g++: error: unrecognized command line option ‘-W -Wall -O3 -pedantic’
如果我这样说,它会起作用:
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
add_compile_options("$<$<CONFIG:RELEASE>:-W>")
add_compile_options("$<$<CONFIG:RELEASE>:-Wall>")
add_compile_options("$<$<CONFIG:RELEASE>:-O3>")
add_compile_options("$<$<CONFIG:RELEASE>:-pedantic>")
add_compile_options("$<$<CONFIG:DEBUG>:-W>")
add_compile_options("$<$<CONFIG:DEBUG>:-Wall>")
add_compile_options("$<$<CONFIG:DEBUG>:-g>")
add_compile_options("$<$<CONFIG:DEBUG>:-O0>")
add_compile_options("$<$<CONFIG:DEBUG>:-pedantic>")
endif()
...但我想这不是故意的...
【问题讨论】:
标签: cmake g++ ubuntu-16.04