aboutsummaryrefslogtreecommitdiff
path: root/cmake/OpenMPTesting.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/OpenMPTesting.cmake')
-rw-r--r--cmake/OpenMPTesting.cmake10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmake/OpenMPTesting.cmake b/cmake/OpenMPTesting.cmake
index 187c874..396460a 100644
--- a/cmake/OpenMPTesting.cmake
+++ b/cmake/OpenMPTesting.cmake
@@ -120,8 +120,16 @@ else()
set(OPENMP_TEST_COMPILER_VERSION "${LLVM_VERSION}")
set(OPENMP_TEST_COMPILER_VERSION_MAJOR "${LLVM_MAJOR_VERSION}")
set(OPENMP_TEST_COMPILER_VERSION_MAJOR_MINOR "${LLVM_MAJOR_VERSION}.${LLVM_MINOR_VERSION}")
+ # Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
+ # CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
+ # around that, until it is fixed there.
+ if(${CMAKE_THREAD_LIBS_INIT} STREQUAL "-lpthread")
+ set(OPENMP_TEST_COMPILER_THREAD_FLAGS "-pthread")
+ else()
+ set(OPENMP_TEST_COMPILER_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+ endif()
# TODO: Implement blockaddress in GlobalISel and remove this flag!
- set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp -fno-experimental-isel")
+ set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp ${OPENMP_TEST_COMPILER_THREAD_FLAGS} -fno-experimental-isel")
endif()
# Function to set compiler features for use in lit.