aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2010-08-09 03:26:43 +0000
committerOscar Fuentes <ofv@wanadoo.es>2010-08-09 03:26:43 +0000
commit6252e987096e5b7154f18cca04d8e1cadc7373da (patch)
treef171e5c5dbf84f898951f78e95abeee8105af992 /cmake
parentfd2f3e66fe8ba33c6a9cfb144ad0c136120ec37a (diff)
CMake: system for providing llvm-config-like features to the user.
The user can use a cmake function for obtaining the LLVM libraries corresponding to a list of LLVM components. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110560 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/CMakeLists.txt11
-rw-r--r--cmake/modules/LLVM.cmake19
-rwxr-xr-xcmake/modules/LLVMConfig.cmake7
3 files changed, 37 insertions, 0 deletions
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
new file mode 100644
index 0000000000..03b1e83da2
--- /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 0000000000..1f63271128
--- /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 7d636eaa76..5c94b126b0 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})