diff --git a/CMakeLists.txt b/CMakeLists.txt index 1035201efe4..8dc2ba7d964 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,6 +361,8 @@ add_subdirectory(tools) option(LLVM_BUILD_EXAMPLES "Build LLVM example programs." OFF) add_subdirectory(examples) +add_subdirectory(cmake/modules) + install(DIRECTORY include/ DESTINATION include FILES_MATCHING diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 00000000000..03b1e83da25 --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,11 @@ +set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/share/llvm/cmake") + +configure_file( + LLVM.cmake + ${llvm_cmake_builddir}/LLVM.cmake) + +install(FILES + ${llvm_cmake_builddir}/LLVM.cmake + LLVMConfig.cmake + LLVMLibDeps.cmake + DESTINATION share/llvm/cmake) diff --git a/cmake/modules/LLVM.cmake b/cmake/modules/LLVM.cmake new file mode 100644 index 00000000000..1f632711281 --- /dev/null +++ b/cmake/modules/LLVM.cmake @@ -0,0 +1,19 @@ +set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@) + +set(llvm_libs @llvm_libs@) + +set(llvm_lib_targets @llvm_lib_targets@) + +set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@) + +set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@) + +set(HAVE_LLVM_CONFIG @HAVE_LLVM_CONFIG@) + +if( NOT EXISTS LLVMConfig.cmake ) + set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + "@LLVM_SOURCE_DIR@/cmake/modules") +endif() + +include( LLVMConfig ) diff --git a/cmake/modules/LLVMConfig.cmake b/cmake/modules/LLVMConfig.cmake index 7d636eaa768..5c94b126b0d 100755 --- a/cmake/modules/LLVMConfig.cmake +++ b/cmake/modules/LLVMConfig.cmake @@ -49,6 +49,13 @@ function(explicit_llvm_config executable) endfunction(explicit_llvm_config) +# This is a variant intended for the final user: +function(llvm_map_components_to_libraries OUT_VAR) + explicit_map_components_to_libraries(result ${ARGN}) + set( ${OUT_VAR} ${result} ) +endfunction(llvm_map_components_to_libraries) + + function(explicit_map_components_to_libraries out_libs) set( link_components ${ARGN} ) foreach(c ${link_components})