1 message(STATUS "LAPACKE enable")
4 set(LAPACK_INSTALL_EXPORT_NAME lapacke-targets)
6 # Create a header file lapacke_mangling.h for the routines called in my C programs
7 include(FortranCInterface)
8 ## Ensure that the fortran compiler and c compiler specified are compatible
9 FortranCInterface_VERIFY()
10 FortranCInterface_HEADER( ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h
11 MACRO_NAMESPACE "LAPACK_"
12 SYMBOL_NAMESPACE "LAPACK_" )
13 if( NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
14 message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
15 configure_file( include/lapacke_mangling_with_flags.h.in
16 ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h )
19 if (WIN32 AND NOT UNIX)
20 add_definitions(-DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE)
21 message (STATUS "Windows BUILD")
24 get_directory_property( DirDefs COMPILE_DEFINITIONS )
26 include_directories( include ${LAPACK_BINARY_DIR}/include )
27 add_subdirectory(include)
29 add_subdirectory(utils)
31 macro(append_subdir_files variable dirname)
32 get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable})
33 foreach(depfile ${holder})
34 list(APPEND ${variable} "${dirname}/${depfile}")
38 append_subdir_files(LAPACKE_INCLUDE "include")
39 append_subdir_files(SRC_OBJ "src")
40 append_subdir_files(SRCX_OBJ "src")
41 append_subdir_files(MATGEN_OBJ "src")
42 append_subdir_files(UTILS_OBJ "utils")
45 add_library(lapacke ${SRC_OBJ} ${SRCX_OBJ} ${UTILS_OBJ})
46 target_link_libraries(lapacke ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${XBLAS_LIBRARY})
49 add_library(lapacke ${SRC_OBJ} ${MATGEN_OBJ} ${UTILS_OBJ})
50 target_link_libraries(lapacke tmglib ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
52 add_library(lapacke ${SRC_OBJ} ${UTILS_OBJ})
53 target_link_libraries(lapacke ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
57 lapack_install_library(lapacke)
58 install( FILES ${LAPACKE_INCLUDE} ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h DESTINATION include )
61 add_subdirectory(example)
65 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapacke.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc @ONLY)
67 ${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc
68 DESTINATION ${PKG_CONFIG_DIR}
71 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-version.cmake.in
72 ${LAPACK_BINARY_DIR}/lapacke-config-version.cmake @ONLY)
73 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-build.cmake.in
74 ${LAPACK_BINARY_DIR}/lapacke-config.cmake @ONLY)
76 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/lapacke-config-install.cmake.in
77 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/lapacke-config.cmake @ONLY)
79 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/lapacke-config.cmake
80 ${LAPACK_BINARY_DIR}/lapacke-config-version.cmake
81 DESTINATION ${LIBRARY_DIR}/cmake/lapacke-${LAPACK_VERSION}
84 install(EXPORT lapacke-targets
85 DESTINATION ${LIBRARY_DIR}/cmake/lapacke-${LAPACK_VERSION})