Adjust no-register CXXFlag.

To account for different flag on some versions of Clang.
This commit is contained in:
John Ralls
2018-10-27 16:19:40 -07:00
parent dddc278851
commit ab1070ebca

View File

@@ -542,10 +542,20 @@ endif (Boost_FOUND)
# Compiler flags
include (CheckCCompilerFlag)
include (CheckCXXCompilerFlag)
check_c_compiler_flag(-Wstringop-truncation have_stringop_truncation)
if (have_stringop_truncation)
set(HAVE_STRINGOP_TRUNCATION TRUE)
endif()
check_cxx_compiler_flag(-Wno-register have_no_register)
if (have_no_register)
set(REGISTER_CXXFLAG -Wno-register)
else()
check_cxx_compiler_flag(-Wno-deprecated-register have_no_dep_register)
if (have_no_dep_register)
set(REGISTER_CXXFLAG -Wno-deprecated-register)
endif()
endif()
add_definitions(-D_GNU_SOURCE)
if (APPLE)
@@ -576,7 +586,7 @@ if (UNIX)
set( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-unused ${CMAKE_C_FLAGS}")
set( CMAKE_C_FLAGS "-Wno-deprecated-declarations -std=gnu11 -Wno-error=parentheses ${CMAKE_C_FLAGS}")
set( CMAKE_CXX_FLAGS "-Werror -Wall -Wmissing-declarations -Wno-unused -Wno-error=parentheses ${CMAKE_CXX_FLAGS}")
set( CMAKE_CXX_FLAGS "-Wno-deprecated-declarations -Wno-register ${CMAKE_CXX_FLAGS}")
set( CMAKE_CXX_FLAGS "-Wno-deprecated-declarations ${REGISTER_CXXFLAG} ${CMAKE_CXX_FLAGS}")
set( CMAKE_C_FLAGS_RELEASE "-O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${CMAKE_C_FLAGS}")
endif (UNIX)
if (MINGW)