mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-06 05:34:59 +00:00
CMake: set -fno-strict-aliasing only if the compiler supports it
This commit is contained in:
parent
65fb9a0406
commit
45a9b99af9
2 changed files with 7 additions and 1 deletions
|
@ -39,7 +39,10 @@ endif(BUILD_tests)
|
|||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ConfigureChecks.cmake)
|
||||
|
||||
set(EXTRA_LINK_AND_COMPILE_FLAGS "-fno-strict-aliasing")
|
||||
set(EXTRA_LINK_AND_COMPILE_FLAGS)
|
||||
if(FLAG_NO_STRICT_ALIASING)
|
||||
set(EXTRA_LINK_AND_COMPILE_FLAGS "${EXTRA_LINK_AND_COMPILE_FLAGS} -fno-strict-aliasing")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
include(CheckCCompilerFlag)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckFunctionExists)
|
||||
|
@ -42,3 +43,5 @@ endif(HAVE_SYS_TYPES_H)
|
|||
|
||||
configure_file(expat_config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_config.h")
|
||||
add_definitions(-DHAVE_EXPAT_CONFIG_H)
|
||||
|
||||
check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING)
|
||||
|
|
Loading…
Add table
Reference in a new issue