diff options
author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-29 19:31:48 +0000 |
---|---|---|
committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-29 19:31:48 +0000 |
commit | 41aebf5e261fc6ab10f01c5be70785d92cf2e5fc (patch) | |
tree | dae7573529362332275e285f83c1c14c6e636724 /cmake | |
parent | b5f5bf534a4c2572afdacfc01f38d1467195732d (diff) |
[CMake] Refactor common settings and flags
These are needed by both libraries, so we can do that in a
common namespace and unify configuration parameters.
Also make sure that the user isn't requesting libomptarget
if the library cannot be built on the system. Issue an error
in that case.
Differential Revision: https://reviews.llvm.org/D40081
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@319342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/HandleOpenMPOptions.cmake | 16 | ||||
-rw-r--r-- | cmake/config-ix.cmake | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/cmake/HandleOpenMPOptions.cmake b/cmake/HandleOpenMPOptions.cmake new file mode 100644 index 0000000..5e5215d --- /dev/null +++ b/cmake/HandleOpenMPOptions.cmake @@ -0,0 +1,16 @@ +if (${OPENMP_STANDALONE_BUILD}) + # From HandleLLVMOptions.cmake + function(append_if condition value) + if (${condition}) + foreach(variable ${ARGN}) + set(${variable} "${${variable}} ${value}" PARENT_SCOPE) + endforeach(variable) + endif() + endfunction() +endif() + +if (${OPENMP_ENABLE_WERROR}) + append_if(OPENMP_HAVE_WERROR_FLAG "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +endif() + +append_if(OPENMP_HAVE_STD_CPP11_FLAG "-std=c++11" CMAKE_CXX_FLAGS)
\ No newline at end of file diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake new file mode 100644 index 0000000..912cbd0 --- /dev/null +++ b/cmake/config-ix.cmake @@ -0,0 +1,6 @@ +include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) + +check_c_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG) + +check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG)
\ No newline at end of file |