Check the existence of flag -faligned-new and add it

This commit is contained in:
Jean Pierre Cimalando 2020-12-13 14:35:30 +01:00
parent 9331ff504f
commit 4b0e4383a4

View file

@ -1,4 +1,5 @@
include(CMakeDependentOption)
include(CheckCXXCompilerFlag)
set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to be used")
set(CMAKE_C_STANDARD 99 CACHE STRING "C standard to be used")
@ -72,6 +73,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_compile_options(-mfloat-abi=hard)
endif()
endif()
check_cxx_compiler_flag(-faligned-new SFIZZ_HAVE_FALIGNED_NEW)
if(SFIZZ_HAVE_FALIGNED_NEW)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-faligned-new>)
endif()
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_STANDARD 17)
add_compile_options(/Zc:__cplusplus)