diff --git a/tools/demo/CMakeLists.txt b/tools/demo/CMakeLists.txt index 4a9e3f5..4cd95b5 100644 --- a/tools/cling/tools/demo/CMakeLists.txt +++ b/tools/cling/tools/demo/CMakeLists.txt @@ -23,6 +23,9 @@ else() # This project needs cling. find_package(cling REQUIRED) + find_package(LLVM REQUIRED CONFIG) + message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") + message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") endif() # The project has one binary: @@ -30,6 +33,6 @@ add_executable(cling-demo cling-demo.cpp) # ...which links against clingInterpreter (and its dependencies). -target_link_libraries(cling-demo clingInterpreter) +target_link_libraries(cling-demo clingInterpreter LLVMSupport) # Provide LLVMDIR to cling-demp.cpp: target_compile_options(cling-demo PUBLIC -DLLVMDIR="${LLVM_INSTALL_PREFIX}" -I${LLVM_INSTALL_PREFIX}/include) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 9cf22b4..438f8e2 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -1,4 +1,4 @@ -set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) +set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/cling/llvm) set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") # First for users who use an installed LLVM, create the LLVMExports.cmake file. diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index d233f552..8aea57f4 100644 --- a/tools/clang/cmake/modules/CMakeLists.txt +++ b/tools/clang/cmake/modules/CMakeLists.txt @@ -1,11 +1,11 @@ # Generate a list of CMake library targets so that other CMake projects can # link against them. LLVM calls its version of this file LLVMExports.cmake, but # the usual CMake convention seems to be ${Project}Targets.cmake. -set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) +set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/cling/clang) set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}") # Keep this in sync with llvm/cmake/CMakeLists.txt! -set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) +set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/cling/llvm) set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS) diff --git a/cmake/modules/LLVMExternalProjectUtils.cmake b/cmake/modules/LLVMExternalProjectUtils.cmake index 9a6adab1..43acb6a8 100644 --- a/cmake/modules/LLVMExternalProjectUtils.cmake +++ b/cmake/modules/LLVMExternalProjectUtils.cmake @@ -187,7 +187,7 @@ function(llvm_ExternalProject_Add name source_dir) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION}) - set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}") + set(resource_dir "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}") set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER) foreach(type ${flag_types}) set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir})