summaryrefslogtreecommitdiffstats
path: root/openmp/cmake/DetectTestCompiler
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2017-11-30 17:08:31 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2017-11-30 17:08:31 +0000
commitfc473dee98fd8d2756983b9d039cd439e5a78f24 (patch)
tree24668270a601fa1c704f3b33a4895fec4c08f3ff /openmp/cmake/DetectTestCompiler
parentc7832045d5e8508713cd3353ea75ff8486add49f (diff)
downloadbcm5719-llvm-fc473dee98fd8d2756983b9d039cd439e5a78f24.tar.gz
bcm5719-llvm-fc473dee98fd8d2756983b9d039cd439e5a78f24.zip
[CMake] Detect information about test compiler
Perform a nested CMake invocation to avoid writing our own parser for compiler versions when we are not testing the in-tree compiler. Use the extracted information to mark a test as unsupported that hangs with Clang prior to version 4.0.1 and restrict tests for libomptarget to Clang version 6.0.0 and later. Differential Revision: https://reviews.llvm.org/D40083 llvm-svn: 319448
Diffstat (limited to 'openmp/cmake/DetectTestCompiler')
-rw-r--r--openmp/cmake/DetectTestCompiler/CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/openmp/cmake/DetectTestCompiler/CMakeLists.txt b/openmp/cmake/DetectTestCompiler/CMakeLists.txt
new file mode 100644
index 00000000000..82d287b8e00
--- /dev/null
+++ b/openmp/cmake/DetectTestCompiler/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8)
+project(DetectTestCompiler C CXX)
+
+function(write_compiler_information lang)
+ set(information "${CMAKE_${lang}_COMPILER}")
+ set(information "${information}\\;${CMAKE_${lang}_COMPILER_ID}")
+ set(information "${information}\\;${CMAKE_${lang}_COMPILER_VERSION}")
+ set(information "${information}\\;${OpenMP_${lang}_FLAGS}")
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${lang}CompilerInformation.txt ${information})
+endfunction(write_compiler_information)
+
+find_package(OpenMP)
+if (NOT OpenMP_Found)
+ set(OpenMP_C_FLAGS "-fopenmp")
+ set(OpenMP_CXX_FLAGS "-fopenmp")
+endif()
+
+write_compiler_information(C)
+write_compiler_information(CXX)
OpenPOWER on IntegriCloud