Skip to content

Commit

Permalink
CMake: system for providing llvm-config-like features to the user.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Oscar Fuentes committed Aug 9, 2010
1 parent fd2f3e6 commit 6252e98
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions cmake/modules/LLVM.cmake
Original file line number Diff line number Diff line change
@@ -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 )
7 changes: 7 additions & 0 deletions cmake/modules/LLVMConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 6252e98

Please sign in to comment.