ext/facter/leatherman/cmake/cflags.cmake in facter-3.12.1.cfacter.20181031 vs ext/facter/leatherman/cmake/cflags.cmake in facter-3.12.2.cfacter.20181217
- old
+ new
@@ -1,10 +1,13 @@
# Set compiler-specific flags
# Each of our project dirs sets CMAKE_CXX_FLAGS based on these. We do
# not set CMAKE_CXX_FLAGS globally because gtest is not warning-clean.
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "\\w*Clang")
- set(LEATHERMAN_CXX_FLAGS "-std=c++11 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-tautological-constant-out-of-range-compare ${CMAKE_CXX_FLAGS}")
+ if (ENABLE_CXX_WERROR)
+ set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
+ endif()
+ set(LEATHERMAN_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-tautological-constant-out-of-range-compare ${CMAKE_CXX_FLAGS}")
# Clang warns that 'register' is deprecated; 'register' is used throughout boost, so it can't be an error yet.
# The warning flag is different on different clang versions so we need to extract the clang version.
# And the Mavericks version of clang report its version in its own special way (at least on 10.9.5) - yay
EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string )
@@ -38,11 +41,15 @@
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# maybe-uninitialized is a relatively new GCC warning that Boost 1.57 violates; disable it for now until it's available in Clang as well
# it's also sometimes wrong
set(CMAKE_CXX_FLAGS "-Wno-maybe-uninitialized ${CMAKE_CXX_FLAGS}")
+ if (ENABLE_CXX_WERROR)
+ set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
+ endif()
+
# missing-field-initializers is disabled because GCC can't make up their mind how to treat C++11 initializers
- set(LEATHERMAN_CXX_FLAGS "-std=c++11 -Wall -Werror -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-unknown-pragmas -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}")
+ set(LEATHERMAN_CXX_FLAGS "-std=c++11 -Wall -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-unknown-pragmas -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}")
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
set(LEATHERMAN_CXX_FLAGS "-Wextra ${LEATHERMAN_CXX_FLAGS}")
endif()
# On Windows with GCC 5.2.0, disable deprecated declarations because it causes warnings with Boost's use of auto_ptr