Use -faligned-new compiler flag only if needed

This commit is contained in:
Carles Fernandez 2019-11-02 10:22:35 +01:00
parent d6b4ba4fc3
commit 6a21f232ff
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
1 changed files with 8 additions and 6 deletions

View File

@ -2501,12 +2501,14 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
add_compile_options(-Wno-psabi)
endif()
if(IS_ARM)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.1.0")
set(CXX_ALIGN_FLAG -faligned-new)
if(NOT (CMAKE_VERSION VERSION_LESS "3.3"))
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${CXX_ALIGN_FLAG}>")
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CXX_ALIGN_FLAG}>")
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.1.0") AND (CMAKE_VERSION VERSION_GREATER "3.1"))
if(CMAKE_CXX_STANDARD VERSION_LESS 17)
set(CXX_ALIGN_FLAG -faligned-new)
if(NOT (CMAKE_VERSION VERSION_LESS "3.3"))
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${CXX_ALIGN_FLAG}>")
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CXX_ALIGN_FLAG}>")
endif()
endif()
endif()
endif()