diff options
-rw-r--r-- | configure.cmake | 3 | ||||
-rw-r--r-- | configurecompiler.cmake | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/configure.cmake b/configure.cmake index 97b4bc6599..3af13f3c15 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1,4 +1,5 @@ include(CheckCXXSourceCompiles) +include(CheckCXXCompilerFlag) # VC++ guarantees support for LTCG (LTO's equivalent) if(NOT WIN32) @@ -9,4 +10,6 @@ if(NOT WIN32) check_cxx_source_compiles("int main() { return 0; }" HAVE_LTO) endfunction(check_have_lto) check_have_lto() + + check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW) endif(NOT WIN32) diff --git a/configurecompiler.cmake b/configurecompiler.cmake index 929dfe54af..38d8d4393d 100644 --- a/configurecompiler.cmake +++ b/configurecompiler.cmake @@ -485,6 +485,9 @@ if (CLR_CMAKE_PLATFORM_UNIX) add_compile_options(-Wno-unused-but-set-variable) add_compile_options(-fms-extensions) add_compile_options(-Wno-unknown-pragmas) + if (COMPILER_SUPPORTS_F_ALIGNED_NEW) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new") + endif() endif() # Some architectures (e.g., ARM) assume char type is unsigned while CoreCLR assumes char is signed |