Patch provided by the kitware team on Aug 5th (Brad King and Bill Hoffman)
authorjulie <julielangou@users.noreply.github.com>
Tue, 10 Aug 2010 16:57:20 +0000 (16:57 +0000)
committerjulie <julielangou@users.noreply.github.com>
Tue, 10 Aug 2010 16:57:20 +0000 (16:57 +0000)
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
CMakeLists.txt
SRC/CMakeLists.txt
lapack-config-install.cmake.in [new file with mode: 0644]

index 55b5a1c7255d261cc0371e1773e317e057c93ced..e99ff79a012f6941c878317b1668d338e88f84fb 100644 (file)
@@ -141,3 +141,4 @@ if(UNIX)
   target_link_libraries(blas m)
 endif()
 target_link_libraries(blas)
+lapack_install_library(blas)
index d733b506bc693e22517c3aed7d1a3e8408d938b0..9ad16426aa3606d27aa39e71e92f2958f987e843 100644 (file)
@@ -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})
index cc2c8748fd82df7ff1d958b9bb5df50d320a6188..3a5d027a427a7fd5f2dade1e1cd6126d55c94e90 100644 (file)
@@ -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 (file)
index 0000000..0c55fc1
--- /dev/null
@@ -0,0 +1,2 @@
+get_filename_component(_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+include(${_SELF_DIR}/lapack-targets.cmake)