Enable -fno-common by default to catch ODR violations
This should prevent ODR-violating code in the futureLT1AB
parent
f65f26e3cc
commit
a9cc014094
|
@ -31,3 +31,19 @@ list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${abs_libdir} isSystemDir)
|
||||||
if("${isSystemDir}" STREQUAL "-1")
|
if("${isSystemDir}" STREQUAL "-1")
|
||||||
list(APPEND CMAKE_INSTALL_RPATH ${abs_libdir})
|
list(APPEND CMAKE_INSTALL_RPATH ${abs_libdir})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(ISCE2_STRICT_COMPILATION "Enable strict checks during compilation" ON)
|
||||||
|
if(ISCE2_STRICT_COMPILATION)
|
||||||
|
|
||||||
|
# Set -fno-common when supported to catch ODR violations
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
check_c_compiler_flag(-fno-common C_FNO_COMMON)
|
||||||
|
if(C_FNO_COMMON)
|
||||||
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:-fno-common>)
|
||||||
|
endif()
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
check_cxx_compiler_flag(-fno-common CXX_FNO_COMMON)
|
||||||
|
if(CXX_FNO_COMMON)
|
||||||
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-common>)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue