From 4ff24babc1c98305f30b50c4f363fdef3ac7f446 Mon Sep 17 00:00:00 2001 From: julie Date: Tue, 10 Aug 2010 16:57:20 +0000 Subject: [PATCH] Patch provided by the kitware team on Aug 5th (Brad King and Bill Hoffman) Add the install rules and exports the targets. Now one can write find_package(LAPACK 3.2.2) in another project to find either the LAPACK build tree or the install tree. --- BLAS/SRC/CMakeLists.txt | 1 + CMakeLists.txt | 18 ++++++++++++++++++ SRC/CMakeLists.txt | 2 +- lapack-config-install.cmake.in | 2 ++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 lapack-config-install.cmake.in diff --git a/BLAS/SRC/CMakeLists.txt b/BLAS/SRC/CMakeLists.txt index 55b5a1c7..e99ff79a 100644 --- a/BLAS/SRC/CMakeLists.txt +++ b/BLAS/SRC/CMakeLists.txt @@ -141,3 +141,4 @@ if(UNIX) target_link_libraries(blas m) endif() target_link_libraries(blas) +lapack_install_library(blas) diff --git a/CMakeLists.txt b/CMakeLists.txt index d733b506..9ad16426 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,14 @@ if (UNIX) endif () endif () +macro(lapack_install_library lib) + install(TARGETS ${lib} EXPORT lapack-targets + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) +endmacro() + # -------------------------------------------------- # Testing @@ -78,3 +86,13 @@ configure_file(${LAPACK_SOURCE_DIR}/lapack-config-version.cmake.in ${LAPACK_BINARY_DIR}/lapack-config-version.cmake @ONLY) configure_file(${LAPACK_SOURCE_DIR}/lapack-config.cmake.in ${LAPACK_BINARY_DIR}/lapack-config.cmake @ONLY) + +configure_file(${LAPACK_SOURCE_DIR}/lapack-config-install.cmake.in + ${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake @ONLY) +install(FILES + ${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake + ${LAPACK_BINARY_DIR}/lapack-config-version.cmake + DESTINATION lib/cmake/lapack-${LAPACK_VERSION} + ) +install(EXPORT lapack-targets + DESTINATION lib/cmake/lapack-${LAPACK_VERSION}) diff --git a/SRC/CMakeLists.txt b/SRC/CMakeLists.txt index cc2c8748..3a5d027a 100644 --- a/SRC/CMakeLists.txt +++ b/SRC/CMakeLists.txt @@ -381,4 +381,4 @@ if(BUILD_COMPLEX16) endif() add_library(lapack ${ALLOBJ} ${ALLXOBJ}) target_link_libraries(lapack blas) - +lapack_install_library(lapack) diff --git a/lapack-config-install.cmake.in b/lapack-config-install.cmake.in new file mode 100644 index 00000000..0c55fc17 --- /dev/null +++ b/lapack-config-install.cmake.in @@ -0,0 +1,2 @@ +get_filename_component(_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +include(${_SELF_DIR}/lapack-targets.cmake) -- 2.34.1