]> granicus.if.org Git - clang/commitdiff
CMake: Replace open-coded find_package
authorTom Stellard <tstellar@redhat.com>
Tue, 13 Nov 2018 03:16:45 +0000 (03:16 +0000)
committerTom Stellard <tstellar@redhat.com>
Tue, 13 Nov 2018 03:16:45 +0000 (03:16 +0000)
Reviewers: beanz, mgorny

Reviewed By: mgorny

Subscribers: cfe-commits, chapuni, llvm-commits

Differential Revision: https://reviews.llvm.org/D32577

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346731 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt

index 0a0f885b2be2381dc0f7a27617d1d8aa8349f3c2..db70fea0d220276bbeba4652adc6f40b68d5d7c2 100644 (file)
@@ -68,13 +68,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
     NO_DEFAULT_PATH)
 
-  set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
-  if(EXISTS ${LLVMCONFIG_FILE})
-    list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
-    include(${LLVMCONFIG_FILE})
-  else()
-    message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
-  endif()
+  find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}")
+  list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR})
 
   # They are used as destination of target generators.
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)