Commit 51da0727 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

cmake: only use -faligned-new and -Wno-noexcept-type if supported

Summary:
On unix platforms, check to see if the compiler supports the `-faligned-new`
and `-Wno-noexcept-type` flags before adding them to the compiler command line
flags.

Reviewed By: yfeldblum

Differential Revision: D6787808

fbshipit-source-id: d34af5ae4251ad3639fdaa1a8d5cb2df4b10e986
parent 507ab831
...@@ -10,7 +10,6 @@ function(apply_folly_compile_options_to_target THETARGET) ...@@ -10,7 +10,6 @@ function(apply_folly_compile_options_to_target THETARGET)
-fopenmp -fopenmp
-finput-charset=UTF-8 -finput-charset=UTF-8
-fsigned-char -fsigned-char
-faligned-new
-Werror -Werror
-Wall -Wall
-Wno-deprecated -Wno-deprecated
...@@ -21,7 +20,7 @@ function(apply_folly_compile_options_to_target THETARGET) ...@@ -21,7 +20,7 @@ function(apply_folly_compile_options_to_target THETARGET)
-Wunused-label -Wunused-label
-Wunused-result -Wunused-result
-Wnon-virtual-dtor -Wnon-virtual-dtor
-Wno-noexcept-type ${FOLLY_CXX_FLAGS}
PRIVATE PRIVATE
-D_REENTRANT -D_REENTRANT
-D_GNU_SOURCE -D_GNU_SOURCE
......
...@@ -30,6 +30,16 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") ...@@ -30,6 +30,16 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (COMPILER_HAS_W_SHADOW_LOCAL AND COMPILER_HAS_W_SHADOW_COMPATIBLE_LOCAL) if (COMPILER_HAS_W_SHADOW_LOCAL AND COMPILER_HAS_W_SHADOW_COMPATIBLE_LOCAL)
set(FOLLY_HAVE_SHADOW_LOCAL_WARNINGS ON) set(FOLLY_HAVE_SHADOW_LOCAL_WARNINGS ON)
endif() endif()
CHECK_CXX_COMPILER_FLAG(-Wno-noexcept-type COMPILER_HAS_W_NOEXCEPT_TYPE)
if (COMPILER_HAS_W_NOEXCEPT_TYPE)
list(APPEND FOLLY_CXX_FLAGS -Wno-noexcept-type)
endif()
CHECK_CXX_COMPILER_FLAG(-faligned-new COMPILER_HAS_F_ALIGNED_NEW)
if (COMPILER_HAS_F_ALIGNED_NEW)
list(APPEND FOLLY_CXX_FLAGS -faligned-new)
endif()
endif() endif()
check_symbol_exists(pthread_atfork pthread.h FOLLY_HAVE_PTHREAD_ATFORK) check_symbol_exists(pthread_atfork pthread.h FOLLY_HAVE_PTHREAD_ATFORK)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment