You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 17 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. cmake_minimum_required(VERSION 2.8.12)
  2. project(LAPACK Fortran C)
  3. set(LAPACK_MAJOR_VERSION 3)
  4. set(LAPACK_MINOR_VERSION 9)
  5. set(LAPACK_PATCH_VERSION 0)
  6. set(
  7. LAPACK_VERSION
  8. ${LAPACK_MAJOR_VERSION}.${LAPACK_MINOR_VERSION}.${LAPACK_PATCH_VERSION}
  9. )
  10. # Add the CMake directory for custon CMake modules
  11. set(CMAKE_MODULE_PATH "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})
  12. # Export all symbols on Windows when building shared libraries
  13. SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
  14. # Set a default build type if none was specified
  15. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  16. message(STATUS "Setting build type to 'Release' as none was specified.")
  17. set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
  18. # Set the possible values of build type for cmake-gui
  19. set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "Coverage")
  20. endif()
  21. # Coverage
  22. set(_is_coverage_build 0)
  23. set(_msg "Checking if build type is 'Coverage'")
  24. message(STATUS "${_msg}")
  25. if(NOT CMAKE_CONFIGURATION_TYPES)
  26. string(TOLOWER ${CMAKE_BUILD_TYPE} _build_type_lc)
  27. if(${_build_type_lc} STREQUAL "coverage")
  28. set(_is_coverage_build 1)
  29. endif()
  30. endif()
  31. message(STATUS "${_msg}: ${_is_coverage_build}")
  32. if(_is_coverage_build)
  33. message(STATUS "Adding coverage")
  34. find_package(codecov)
  35. endif()
  36. # By default static library
  37. option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
  38. # By default build index32 library
  39. option(BUILD_INDEX64 "Build Index-64 API libraries" OFF)
  40. if(BUILD_INDEX64)
  41. set(BLASLIB "blas64")
  42. set(CBLASLIB "cblas64")
  43. set(LAPACKLIB "lapack64")
  44. set(LAPACKELIB "lapacke64")
  45. set(TMGLIB "tmglib64")
  46. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWeirdNEC -DLAPACK_ILP64 -DHAVE_LAPACK_CONFIG_H")
  47. set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8")
  48. else()
  49. set(BLASLIB "blas")
  50. set(CBLASLIB "cblas")
  51. set(LAPACKLIB "lapack")
  52. set(LAPACKELIB "lapacke")
  53. set(TMGLIB "tmglib")
  54. endif()
  55. include(GNUInstallDirs)
  56. # Updated OSX RPATH settings
  57. # In response to CMake 3.0 generating warnings regarding policy CMP0042,
  58. # the OSX RPATH settings have been updated per recommendations found
  59. # in the CMake Wiki:
  60. # http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH
  61. set(CMAKE_MACOSX_RPATH ON)
  62. set(CMAKE_SKIP_BUILD_RPATH FALSE)
  63. set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  64. list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_FULL_LIBDIR} isSystemDir)
  65. if("${isSystemDir}" STREQUAL "-1")
  66. set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
  67. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  68. endif()
  69. # Configure the warning and code coverage suppression file
  70. configure_file(
  71. "${LAPACK_SOURCE_DIR}/CTestCustom.cmake.in"
  72. "${LAPACK_BINARY_DIR}/CTestCustom.cmake"
  73. @ONLY
  74. )
  75. include(PreventInSourceBuilds)
  76. include(PreventInBuildInstalls)
  77. if(UNIX)
  78. if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
  79. set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
  80. endif()
  81. if(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
  82. set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none")
  83. endif()
  84. # Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
  85. # This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
  86. string(REPLACE \;mtsk\; \; CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}")
  87. endif()
  88. if(CMAKE_Fortran_COMPILER_ID STREQUAL Compaq)
  89. if(WIN32)
  90. if(CMAKE_GENERATOR STREQUAL "NMake Makefiles")
  91. get_filename_component(CMAKE_Fortran_COMPILER_CMDNAM ${CMAKE_Fortran_COMPILER} NAME_WE)
  92. message(STATUS "Using Compaq Fortran compiler with command name ${CMAKE_Fortran_COMPILER_CMDNAM}")
  93. set(cmd ${CMAKE_Fortran_COMPILER_CMDNAM})
  94. string(TOLOWER "${cmd}" cmdlc)
  95. if(cmdlc STREQUAL "df")
  96. message(STATUS "Assume the Compaq Visual Fortran Compiler is being used")
  97. set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1)
  98. set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_INCLUDES 1)
  99. #This is a workaround that is needed to avoid forward-slashes in the
  100. #filenames listed in response files from incorrectly being interpreted as
  101. #introducing compiler command options
  102. if(${BUILD_SHARED_LIBS})
  103. message(FATAL_ERROR "Making of shared libraries with CVF has not been tested.")
  104. endif()
  105. set(str "NMake version 9 or later should be used. NMake version 6.0 which is\n")
  106. set(str "${str} included with the CVF distribution fails to build Lapack because\n")
  107. set(str "${str} the number of source files exceeds the limit for NMake v6.0\n")
  108. message(STATUS ${str})
  109. set(CMAKE_Fortran_LINK_EXECUTABLE "LINK /out:<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>")
  110. endif()
  111. endif()
  112. endif()
  113. endif()
  114. # --------------------------------------------------
  115. set(LAPACK_INSTALL_EXPORT_NAME ${LAPACKLIB}-targets)
  116. macro(lapack_install_library lib)
  117. install(TARGETS ${lib}
  118. EXPORT ${LAPACK_INSTALL_EXPORT_NAME}
  119. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
  120. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
  121. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT RuntimeLibraries
  122. )
  123. endmacro()
  124. set(PKG_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
  125. # --------------------------------------------------
  126. # Testing
  127. option(BUILD_TESTING "Build tests" ${_is_coverage_build})
  128. include(CTest)
  129. message(STATUS "Build tests: ${BUILD_TESTING}")
  130. # lapack_testing.py uses features from python 2.7 and greater
  131. if(BUILD_TESTING)
  132. set(_msg "Looking for Python >= 2.7 needed for summary tests")
  133. message(STATUS "${_msg}")
  134. find_package(PythonInterp 2.7 QUIET)
  135. if(PYTHONINTERP_FOUND)
  136. message(STATUS "${_msg} - found (${PYTHON_VERSION_STRING})")
  137. else()
  138. message(STATUS "${_msg} - not found (skipping summary tests)")
  139. endif()
  140. endif()
  141. # --------------------------------------------------
  142. # Organize output files. On Windows this also keeps .dll files next
  143. # to the .exe files that need them, making tests easy to run.
  144. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LAPACK_BINARY_DIR}/bin)
  145. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LAPACK_BINARY_DIR}/lib)
  146. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LAPACK_BINARY_DIR}/lib)
  147. # --------------------------------------------------
  148. # Check for any necessary platform specific compiler flags
  149. include(CheckLAPACKCompilerFlags)
  150. CheckLAPACKCompilerFlags()
  151. # --------------------------------------------------
  152. # Check second function
  153. include(CheckTimeFunction)
  154. set(TIME_FUNC NONE ${TIME_FUNC})
  155. CHECK_TIME_FUNCTION(NONE TIME_FUNC)
  156. CHECK_TIME_FUNCTION(INT_CPU_TIME TIME_FUNC)
  157. CHECK_TIME_FUNCTION(EXT_ETIME TIME_FUNC)
  158. CHECK_TIME_FUNCTION(EXT_ETIME_ TIME_FUNC)
  159. CHECK_TIME_FUNCTION(INT_ETIME TIME_FUNC)
  160. message(STATUS "--> Will use second_${TIME_FUNC}.f and dsecnd_${TIME_FUNC}.f as timing function.")
  161. set(SECOND_SRC ${LAPACK_SOURCE_DIR}/INSTALL/second_${TIME_FUNC}.f)
  162. set(DSECOND_SRC ${LAPACK_SOURCE_DIR}/INSTALL/dsecnd_${TIME_FUNC}.f)
  163. # deprecated LAPACK and LAPACKE routines
  164. option(BUILD_DEPRECATED "Build deprecated routines" OFF)
  165. message(STATUS "Build deprecated routines: ${BUILD_DEPRECATED}")
  166. # --------------------------------------------------
  167. # Precision to build
  168. # By default all precisions are generated
  169. option(BUILD_SINGLE "Build single precision real" ON)
  170. option(BUILD_DOUBLE "Build double precision real" ON)
  171. option(BUILD_COMPLEX "Build single precision complex" ON)
  172. option(BUILD_COMPLEX16 "Build double precision complex" ON)
  173. message(STATUS "Build single precision real: ${BUILD_SINGLE}")
  174. message(STATUS "Build double precision real: ${BUILD_DOUBLE}")
  175. message(STATUS "Build single precision complex: ${BUILD_COMPLEX}")
  176. message(STATUS "Build double precision complex: ${BUILD_COMPLEX16}")
  177. if(NOT (BUILD_SINGLE OR BUILD_DOUBLE OR BUILD_COMPLEX OR BUILD_COMPLEX16))
  178. message(FATAL_ERROR "Nothing to build, no precision selected.
  179. Please enable at least one of these:
  180. BUILD_SINGLE, BUILD_DOUBLE, BUILD_COMPLEX, BUILD_COMPLEX16.")
  181. endif()
  182. # --------------------------------------------------
  183. # Subdirectories that need to be processed
  184. option(USE_OPTIMIZED_BLAS "Whether or not to use an optimized BLAS library instead of included netlib BLAS" OFF)
  185. # Check the usage of the user provided BLAS libraries
  186. if(BLAS_LIBRARIES)
  187. include(CheckFortranFunctionExists)
  188. set(CMAKE_REQUIRED_LIBRARIES ${BLAS_LIBRARIES})
  189. CHECK_FORTRAN_FUNCTION_EXISTS("dgemm" BLAS_FOUND)
  190. unset(CMAKE_REQUIRED_LIBRARIES)
  191. if(BLAS_FOUND)
  192. message(STATUS "--> BLAS supplied by user is WORKING, will use ${BLAS_LIBRARIES}.")
  193. else()
  194. message(ERROR "--> BLAS supplied by user is not WORKING, CANNOT USE ${BLAS_LIBRARIES}.")
  195. message(ERROR "--> Will use REFERENCE BLAS (by default)")
  196. message(ERROR "--> Or Correct your BLAS_LIBRARIES entry ")
  197. message(ERROR "--> Or Consider checking USE_OPTIMIZED_BLAS")
  198. endif()
  199. # User did not provide a BLAS Library but specified to search for one
  200. elseif(USE_OPTIMIZED_BLAS)
  201. find_package(BLAS)
  202. endif()
  203. # Neither user specified or optimized BLAS libraries can be used
  204. if(NOT BLAS_FOUND)
  205. message(STATUS "Using supplied NETLIB BLAS implementation")
  206. add_subdirectory(BLAS)
  207. set(BLAS_LIBRARIES ${BLASLIB})
  208. else()
  209. set(CMAKE_EXE_LINKER_FLAGS
  210. "${CMAKE_EXE_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}"
  211. CACHE STRING "Linker flags for executables" FORCE)
  212. set(CMAKE_MODULE_LINKER_FLAGS
  213. "${CMAKE_MODULE_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}"
  214. CACHE STRING "Linker flags for modules" FORCE)
  215. set(CMAKE_SHARED_LINKER_FLAGS
  216. "${CMAKE_SHARED_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}"
  217. CACHE STRING "Linker flags for shared libs" FORCE)
  218. endif()
  219. # --------------------------------------------------
  220. # CBLAS
  221. option(CBLAS "Build CBLAS" OFF)
  222. if(CBLAS)
  223. add_subdirectory(CBLAS)
  224. endif()
  225. # --------------------------------------------------
  226. # XBLAS
  227. option(USE_XBLAS "Build extended precision (needs XBLAS)" OFF)
  228. if(USE_XBLAS)
  229. find_library(XBLAS_LIBRARY NAMES xblas)
  230. endif()
  231. option(USE_OPTIMIZED_LAPACK "Whether or not to use an optimized LAPACK library instead of included netlib LAPACK" OFF)
  232. # --------------------------------------------------
  233. # LAPACK
  234. # User did not provide a LAPACK Library but specified to search for one
  235. if(USE_OPTIMIZED_LAPACK)
  236. find_package(LAPACK)
  237. endif()
  238. # Check the usage of the user provided or automatically found LAPACK libraries
  239. if(LAPACK_LIBRARIES)
  240. include(CheckFortranFunctionExists)
  241. set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
  242. # Check if new routine of 3.4.0 is in LAPACK_LIBRARIES
  243. CHECK_FORTRAN_FUNCTION_EXISTS("dgeqrt" LATESTLAPACK_FOUND)
  244. unset(CMAKE_REQUIRED_LIBRARIES)
  245. if(LATESTLAPACK_FOUND)
  246. message(STATUS "--> LAPACK supplied by user is WORKING, will use ${LAPACK_LIBRARIES}.")
  247. else()
  248. message(ERROR "--> LAPACK supplied by user is not WORKING or is older than LAPACK 3.4.0, CANNOT USE ${LAPACK_LIBRARIES}.")
  249. message(ERROR "--> Will use REFERENCE LAPACK (by default)")
  250. message(ERROR "--> Or Correct your LAPACK_LIBRARIES entry ")
  251. message(ERROR "--> Or Consider checking USE_OPTIMIZED_LAPACK")
  252. endif()
  253. endif()
  254. # Neither user specified or optimized LAPACK libraries can be used
  255. if(NOT LATESTLAPACK_FOUND)
  256. message(STATUS "Using supplied NETLIB LAPACK implementation")
  257. set(LAPACK_LIBRARIES ${LAPACKLIB})
  258. add_subdirectory(SRC)
  259. else()
  260. set(CMAKE_EXE_LINKER_FLAGS
  261. "${CMAKE_EXE_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS}"
  262. CACHE STRING "Linker flags for executables" FORCE)
  263. set(CMAKE_MODULE_LINKER_FLAGS
  264. "${CMAKE_MODULE_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS}"
  265. CACHE STRING "Linker flags for modules" FORCE)
  266. set(CMAKE_SHARED_LINKER_FLAGS
  267. "${CMAKE_SHARED_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS}"
  268. CACHE STRING "Linker flags for shared libs" FORCE)
  269. endif()
  270. if(BUILD_TESTING)
  271. add_subdirectory(TESTING)
  272. endif()
  273. # --------------------------------------------------
  274. # LAPACKE
  275. option(LAPACKE "Build LAPACKE" OFF)
  276. # LAPACKE has also the interface to some routines from tmglib,
  277. # if LAPACKE_WITH_TMG is selected, we need to add those routines to LAPACKE
  278. option(LAPACKE_WITH_TMG "Build LAPACKE with tmglib routines" OFF)
  279. if(LAPACKE_WITH_TMG)
  280. set(LAPACKE ON)
  281. endif()
  282. if(BUILD_TESTING OR LAPACKE_WITH_TMG) #already included, avoid double inclusion
  283. add_subdirectory(TESTING/MATGEN)
  284. endif()
  285. if(LAPACKE)
  286. add_subdirectory(LAPACKE)
  287. endif()
  288. #-------------------------------------
  289. # BLAS++ / LAPACK++
  290. option(BLAS++ "Build BLAS++" OFF)
  291. option(LAPACK++ "Build LAPACK++" OFF)
  292. function(_display_cpp_implementation_msg name)
  293. string(TOLOWER ${name} name_lc)
  294. message(STATUS "${name}++ enable")
  295. message(STATUS "----------------")
  296. message(STATUS "Thank you for your interest in ${name}++, a newly developed C++ API for ${name} library")
  297. message(STATUS "The objective of ${name}++ is to provide a convenient, performance oriented API for development in the C++ language, that, for the most part, preserves established conventions, while, at the same time, takes advantages of modern C++ features, such as: namespaces, templates, exceptions, etc.")
  298. message(STATUS "We are still working on integrating ${name}++ in our library. For the moment, you can download directly ${name_lc}++ from https://bitbucket.org/icl/${name_lc}pp")
  299. message(STATUS "For support ${name}++ related question, please email: slate-user@icl.utk.edu")
  300. message(STATUS "----------------")
  301. endfunction()
  302. if(BLAS++)
  303. _display_cpp_implementation_msg("BLAS")
  304. endif()
  305. if(LAPACK++)
  306. _display_cpp_implementation_msg("LAPACK")
  307. endif()
  308. # --------------------------------------------------
  309. # CPACK Packaging
  310. set(CPACK_PACKAGE_NAME "LAPACK")
  311. set(CPACK_PACKAGE_VENDOR "University of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd")
  312. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LAPACK- Linear Algebra Package")
  313. set(CPACK_PACKAGE_VERSION_MAJOR ${LAPACK_MAJOR_VERSION})
  314. set(CPACK_PACKAGE_VERSION_MINOR ${LAPACK_MINOR_VERSION})
  315. set(CPACK_PACKAGE_VERSION_PATCH ${LAPACK_PATCH_VERSION})
  316. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
  317. set(CPACK_MONOLITHIC_INSTALL ON)
  318. set(CPACK_PACKAGE_INSTALL_DIRECTORY "LAPACK")
  319. if(WIN32 AND NOT UNIX)
  320. # There is a bug in NSI that does not handle full unix paths properly. Make
  321. # sure there is at least one set of four (4) backlasshes.
  322. set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\http://icl.cs.utk.edu/lapack-forum")
  323. set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.netlib.org/lapack")
  324. set(CPACK_NSIS_CONTACT "lapack@eecs.utk.edu")
  325. set(CPACK_NSIS_MODIFY_PATH ON)
  326. set(CPACK_NSIS_DISPLAY_NAME "LAPACK-${LAPACK_VERSION}")
  327. set(CPACK_PACKAGE_RELOCATABLE "true")
  328. else()
  329. set(CPACK_GENERATOR "TGZ")
  330. set(CPACK_SOURCE_GENERATOR TGZ)
  331. set(CPACK_SOURCE_PACKAGE_FILE_NAME "lapack-${LAPACK_VERSION}")
  332. set(CPACK_SOURCE_IGNORE_FILES ~$ .svn ${CPACK_SOURCE_IGNORE_FILES})
  333. endif()
  334. include(CPack)
  335. # --------------------------------------------------
  336. if(NOT BLAS_FOUND)
  337. set(ALL_TARGETS ${ALL_TARGETS} ${BLASLIB})
  338. endif()
  339. if(NOT LATESTLAPACK_FOUND)
  340. set(ALL_TARGETS ${ALL_TARGETS} ${LAPACKLIB})
  341. endif()
  342. if(BUILD_TESTING OR LAPACKE_WITH_TMG)
  343. set(ALL_TARGETS ${ALL_TARGETS} ${TMGLIB})
  344. endif()
  345. # Export lapack targets, not including lapacke, from the
  346. # install tree, if any.
  347. set(_lapack_config_install_guard_target "")
  348. if(ALL_TARGETS)
  349. install(EXPORT ${LAPACKLIB}-targets
  350. DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKLIB}-${LAPACK_VERSION}
  351. COMPONENT Development
  352. )
  353. # Choose one of the lapack targets to use as a guard for
  354. # lapack-config.cmake to load targets from the install tree.
  355. list(GET ALL_TARGETS 0 _lapack_config_install_guard_target)
  356. endif()
  357. # Include cblas in targets exported from the build tree.
  358. if(CBLAS)
  359. set(ALL_TARGETS ${ALL_TARGETS} ${CBLASLIB})
  360. endif()
  361. # Include lapacke in targets exported from the build tree.
  362. if(LAPACKE)
  363. set(ALL_TARGETS ${ALL_TARGETS} ${LAPACKELIB})
  364. endif()
  365. # Export lapack and lapacke targets from the build tree, if any.
  366. set(_lapack_config_build_guard_target "")
  367. if(ALL_TARGETS)
  368. export(TARGETS ${ALL_TARGETS} FILE ${LAPACKLIB}-targets.cmake)
  369. # Choose one of the lapack or lapacke targets to use as a guard
  370. # for lapack-config.cmake to load targets from the build tree.
  371. list(GET ALL_TARGETS 0 _lapack_config_build_guard_target)
  372. endif()
  373. configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-build.cmake.in
  374. ${LAPACK_BINARY_DIR}/${LAPACKLIB}-config.cmake @ONLY)
  375. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapack.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}.pc @ONLY)
  376. install(FILES
  377. ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}.pc
  378. DESTINATION ${PKG_CONFIG_DIR}
  379. COMPONENT Development
  380. )
  381. configure_file(${LAPACK_SOURCE_DIR}/CMAKE/lapack-config-install.cmake.in
  382. ${LAPACK_BINARY_DIR}/CMakeFiles/${LAPACKLIB}-config.cmake @ONLY)
  383. include(CMakePackageConfigHelpers)
  384. write_basic_package_version_file(
  385. ${LAPACK_BINARY_DIR}/${LAPACKLIB}-config-version.cmake
  386. VERSION ${LAPACK_VERSION}
  387. COMPATIBILITY SameMajorVersion
  388. )
  389. install(FILES
  390. ${LAPACK_BINARY_DIR}/CMakeFiles/${LAPACKLIB}-config.cmake
  391. ${LAPACK_BINARY_DIR}/${LAPACKLIB}-config-version.cmake
  392. DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKLIB}-${LAPACK_VERSION}
  393. COMPONENT Development
  394. )