aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorjulie <julielangou@users.noreply.github.com>2014-02-09 00:37:45 +0000
committerjulie <julielangou@users.noreply.github.com>2014-02-09 00:37:45 +0000
commitdf747406083c0d2a08d7e2c9b8ad7b93a570e104 (patch)
treea98b3e15c0f92544337618fbdfc41435c9478b24 /CMakeLists.txt
parenta681d8fc7a25c6fc3c90ce0fff72dfd60c23e0f8 (diff)
== Patch provided by Brad King from Kitware - brad.king@kitware.com ==
Provide CMake packages for both LAPACK and LAPACKE Teach "lapack-config.cmake" to provide variables LAPACK_blas_LIBRARIES LAPACK_lapack_LIBRARIES that contain either the target names when using the reference implementation or the system libraries found for them. Configure a "lapacke-config.cmake" file for the build and install trees to package LAPACKE. Teach it to load the LAPACK package installed with it. Provide variables LAPACKE_INCLUDE_DIRS LAPACKE_LIBRARIES containing the header file search path for lapacke headers and the list of lapacke library targets. This requires CMake 2.8.10 to separate the installation export for the lapacke library from the other targets.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt36
1 files changed, 29 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb4a3658..0ab93224 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,8 @@
-cmake_minimum_required(VERSION 2.8.7)
+cmake_minimum_required(VERSION 2.8.10)
project(LAPACK Fortran)
+set(LAPACK_VERSION 3.4.2)
+
# Configure the warning and code coverage suppression file
configure_file(
"${LAPACK_SOURCE_DIR}/CTestCustom.cmake.in"
@@ -31,8 +33,11 @@ if (PYTHONINTERP_FOUND)
endif()
# --------------------------------------------------
+set(LAPACK_INSTALL_EXPORT_NAME lapack-targets)
+
macro(lapack_install_library lib)
- install(TARGETS ${lib} EXPORT lapack-targets
+ install(TARGETS ${lib}
+ EXPORT ${LAPACK_INSTALL_EXPORT_NAME}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
LIBRARY DESTINATION lib${LIB_SUFFIX}
RUNTIME DESTINATION bin
@@ -203,7 +208,6 @@ endif(LAPACKE)
SET(CPACK_PACKAGE_NAME "LAPACK")
SET(CPACK_PACKAGE_VENDOR "University of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LAPACK- Linear Algebra Package")
-set(LAPACK_VERSION 3.4.2)
set(CPACK_PACKAGE_VERSION_MAJOR 3)
set(CPACK_PACKAGE_VERSION_MINOR 4)
set(CPACK_PACKAGE_VERSION_PATCH 2)
@@ -245,11 +249,32 @@ if(BUILD_TESTING OR LAPACKE_WITH_TMG)
set(ALL_TARGETS ${ALL_TARGETS} tmglib)
endif(BUILD_TESTING OR LAPACKE_WITH_TMG)
+# Export lapack targets, not including lapacke, from the
+# install tree, if any.
+set(_lapack_config_install_guard_target "")
+if(ALL_TARGETS)
+ install(EXPORT lapack-targets
+ DESTINATION lib/cmake/lapack-${LAPACK_VERSION})
+
+ # Choose one of the lapack targets to use as a guard for
+ # lapack-config.cmake to load targets from the install tree.
+ list(GET ALL_TARGETS 0 _lapack_config_install_guard_target)
+endif()
+
+# Include lapacke in targets exported from the build tree.
if(LAPACKE)
set(ALL_TARGETS ${ALL_TARGETS} lapacke)
endif(LAPACKE)
-export(TARGETS ${ALL_TARGETS} FILE lapack-targets.cmake)
+# Export lapack and lapacke targets from the build tree, if any.
+set(_lapack_config_build_guard_target "")
+if(ALL_TARGETS)
+ export(TARGETS ${ALL_TARGETS} FILE lapack-targets.cmake)
+
+ # Choose one of the lapack or lapacke targets to use as a guard
+ # for lapack-config.cmake to load targets from the build tree.
+ list(GET ALL_TARGETS 0 _lapack_config_build_guard_target)
+endif()
configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-version.cmake.in
${LAPACK_BINARY_DIR}/lapack-config-version.cmake @ONLY)
@@ -270,6 +295,3 @@ install(FILES
${LAPACK_BINARY_DIR}/lapack-config-version.cmake
DESTINATION lib/cmake/lapack-${LAPACK_VERSION}
)
-
-install(EXPORT lapack-targets
- DESTINATION lib/cmake/lapack-${LAPACK_VERSION})