如何在头文件和源文件中禁用GCC编译器的警告?
在主要的CMakeLisits.txt中:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++ -std=c++11")
...
add_subdirectory(lib)
在lib CMakeLisits.txt中:
set(lib_SOURCES
...)
include_directories(${lib_SOURCE_DIR}/include ${lib_BINARY_DIR}/include)
add_library(ilib STATIC ${ilib_EXTRA_CFLAGS} ${ilib_SOURCES})
...
..
我已尝试添加lib CMakeLists.txt
include_directories(SYSTEM ${lib_SOURCE_DIR}/include ${lib_BINARY_DIR}/include)
并且它有助于标题,但我仍然在*.cpp
个文件中有警告
然后我试了
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-effc++")
lib中的,CMakeLists.txt和标题中的警告再次出现
不明白发生了什么
CMake version 2.8.12.2
gcc version 4.9.3