Skip to content

Commit ce507a8

Browse files
committed
[Runtimes] Default build must use its own output dir
1 parent 3a08e42 commit ce507a8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

runtimes/CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ if (NOT LLVM_FOUND)
7777
set(LLVM_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
7878
endif()
7979

80-
# Setting these variables will allow the sub-build to put their outputs into
81-
# the library and bin directories of the top-level build.
82-
set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
83-
set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
84-
8580
# This variable makes sure that e.g. llvm-lit is found.
8681
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../llvm)
8782
set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
@@ -99,6 +94,17 @@ if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSIO
9994
set(LLVM_TREE_AVAILABLE ON)
10095
endif()
10196

97+
if(LLVM_TREE_AVAILABLE)
98+
# Setting these variables will allow the sub-build to put their outputs into
99+
# the library and bin directories of the top-level build.
100+
set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
101+
set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
102+
else()
103+
# Use own build directory for artifact output.
104+
set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
105+
set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/bin")
106+
endif()
107+
102108
# CMake omits default compiler include paths, but in runtimes build, we use
103109
# -nostdinc and -nostdinc++ and control include paths manually so this behavior
104110
# is undesirable. Filtering CMAKE_{LANG}_IMPLICIT_INCLUDE_DIRECTORIES to remove

0 commit comments

Comments
 (0)