Commit e8696645 authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

cmake: add config check for openmp support

Summary:
Some compilers such as Apple Clang do not support the compiler flag `-fopenmp`. So, do not add it by default to the list of `CXX_FLAGS` that are expected for *every* compiler to support. Instead, check if the `CXX_COMPILER` specified by `CMake` supports `-fopenmp` by using `CHECK_CXX_COMPILER_FLAG`.
Closes https://github.com/facebook/folly/pull/741

Reviewed By: simpkins

Differential Revision: D6843171

Pulled By: yfeldblum

fbshipit-source-id: 671958d867400b5802d7d563036639d61d11f615
parent b1646f92
...@@ -8,7 +8,6 @@ function(apply_folly_compile_options_to_target THETARGET) ...@@ -8,7 +8,6 @@ function(apply_folly_compile_options_to_target THETARGET)
PUBLIC PUBLIC
-g -g
-std=gnu++14 -std=gnu++14
-fopenmp
-finput-charset=UTF-8 -finput-charset=UTF-8
-fsigned-char -fsigned-char
-Werror -Werror
......
...@@ -41,6 +41,11 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") ...@@ -41,6 +41,11 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (COMPILER_HAS_F_ALIGNED_NEW) if (COMPILER_HAS_F_ALIGNED_NEW)
list(APPEND FOLLY_CXX_FLAGS -faligned-new) list(APPEND FOLLY_CXX_FLAGS -faligned-new)
endif() endif()
CHECK_CXX_COMPILER_FLAG(-fopenmp COMPILER_HAS_F_OPENMP)
if (COMPILER_HAS_F_OPENMP)
list(APPEND FOLLY_CXX_FLAGS -fopenmp)
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