Skip to content

Commit 50201b1

Browse files
Meinersburkrishna2803
authored andcommitted
[OpenMP] Fix LLVM_ENABLE_PROJECTS=openmp build (llvm#151117)
Set LLVM_TREE_AVAILABLE when not defined after llvm#149871. In particular, the LLVM build tree is obviously available with `add_subdirectory(openmp)` from the LLVM build tree itself. Note that this build mode is deprecated since llvm#136314.
1 parent 7cbce24 commit 50201b1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

openmp/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ endif()
2121
include(GNUInstallDirs)
2222

2323
if (OPENMP_STANDALONE_BUILD)
24+
set(LLVM_TREE_AVAILABLE False)
25+
2426
# CMAKE_BUILD_TYPE was not set, default to Release.
2527
if (NOT CMAKE_BUILD_TYPE)
2628
set(CMAKE_BUILD_TYPE Release)
@@ -48,6 +50,15 @@ if (OPENMP_STANDALONE_BUILD)
4850
set(CMAKE_CXX_STANDARD_REQUIRED NO)
4951
set(CMAKE_CXX_EXTENSIONS NO)
5052
else()
53+
# Usually <llvm-project>/runtimes/CMakeLists.txt sets LLVM_TREE_AVAILABLE and
54+
# we assume it is not available otherwise. The exception is that we are in an
55+
# LLVM_ENABLE_PROJECTS=openmp build, the LLVM tree is actually available.
56+
# Note that this build mode has been deprecated.
57+
# See https://github.com/llvm/llvm-project/issues/124014
58+
if (NOT LLVM_RUNTIMES_BUILD AND "openmp" IN_LIST LLVM_ENABLE_PROJECTS)
59+
set(LLVM_TREE_AVAILABLE True)
60+
endif ()
61+
5162
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
5263

5364
# When building in tree we install the runtime according to the LLVM settings.

0 commit comments

Comments
 (0)