Skip to content

Commit d31247c

Browse files
authored
Merge pull request #3199 from gottesmm/import_llvmconfig_using_cmake_module_path_instead_of_finding_abs_path
Import llvmconfig using cmake module path instead of finding abs path
2 parents 1f2b5ee + 41e375a commit d31247c

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,23 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
2727
precondition_translate_flag(${product}_PATH_TO_LLVM_SOURCE PATH_TO_LLVM_SOURCE)
2828
precondition_translate_flag(${product}_PATH_TO_LLVM_BUILD PATH_TO_LLVM_BUILD)
2929

30-
set(LLVM_CMAKE_PATHS
30+
set(SWIFT_LLVM_CMAKE_PATHS
3131
"${PATH_TO_LLVM_BUILD}/share/llvm/cmake"
3232
"${PATH_TO_LLVM_BUILD}/lib/cmake/llvm")
3333

34-
set(LLVMCONFIG_FILE)
35-
foreach(CMAKE_PATH ${LLVM_CMAKE_PATHS})
36-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PATH}")
37-
38-
if(EXISTS "${CMAKE_PATH}/LLVMConfig.cmake")
39-
set(LLVMCONFIG_FILE "${CMAKE_PATH}/LLVMConfig.cmake")
40-
break()
41-
endif()
34+
# Add all LLVM CMake paths to our cmake module path.
35+
foreach(path ${SWIFT_LLVM_CMAKE_PATHS})
36+
list(APPEND CMAKE_MODULE_PATH ${path})
4237
endforeach()
4338

44-
if(${LLVMCONFIG_FILE} STREQUAL "")
45-
message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
46-
endif()
47-
4839
# If we already have a cached value for LLVM_ENABLE_ASSERTIONS, save the value.
4940
if (DEFINED LLVM_ENABLE_ASSERTIONS)
5041
set(LLVM_ENABLE_ASSERTIONS_saved "${LLVM_ENABLE_ASSERTIONS}")
5142
endif()
5243

53-
# Then we import LLVMCONFIG_FILE. This is going to override whatever cached
54-
# value we have for LLVM_ENABLE_ASSERTIONS.
55-
include(${LLVMCONFIG_FILE})
44+
# Then we import LLVMConfig. This is going to override whatever cached value
45+
# we have for LLVM_ENABLE_ASSERTIONS.
46+
include(LLVMConfig)
5647

5748
# If we did not have a cached value for LLVM_ENABLE_ASSERTIONS, set
5849
# LLVM_ENABLE_ASSERTIONS_saved to be the ENABLE_ASSERTIONS value from LLVM so

0 commit comments

Comments
 (0)