CMake: Fix stand-alone clang builds since r353268
authorTom Stellard <tstellar@redhat.com>
Wed, 20 Feb 2019 01:11:05 +0000 (01:11 +0000)
committerTom Stellard <tstellar@redhat.com>
Wed, 20 Feb 2019 01:11:05 +0000 (01:11 +0000)
Summary:
Handle the case where LLVM_MAIN_SRC_DIR is not set and also use
LLVM_CMAKE_DIR for locating installed cmake files rather than
LLVM_CMAKE_PATH.

Reviewers: phosek, andrewrk, smeenai

Reviewed By: phosek, andrewrk, smeenai

Subscribers: mgorny, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 354417

clang/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake

index 40cf7df..f74837c 100644 (file)
@@ -75,6 +75,11 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
     set(LIBRARY_DIR ${LLVM_LIBRARY_DIR})
     set(INCLUDE_DIR ${LLVM_INCLUDE_DIR})
     set(LLVM_OBJ_DIR ${LLVM_BINARY_DIR})
+    # The LLVM_CMAKE_PATH variable is set when doing non-standalone builds and
+    # used in this project, so we need to make sure we set this value.
+    # FIXME: LLVM_CMAKE_DIR comes from LLVMConfig.cmake.  We should rename
+    # LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project.
+    set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR})
   endif()
 
   set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
index 95a88af..3432743 100644 (file)
@@ -1718,6 +1718,9 @@ function(setup_dependency_debugging name)
 endfunction()
 
 function(find_first_existing_vc_file path out_var)
+  if(NOT EXISTS "${path}")
+    return()
+  endif()
   if(EXISTS "${path}/.svn")
     set(svn_files
       "${path}/.svn/wc.db"   # SVN 1.7