| 1 |
message(STATUS "CBLAS enabled") |
| 2 |
enable_language(C) |
| 3 |
|
| 4 |
set(LAPACK_INSTALL_EXPORT_NAME ${CBLASLIB}-targets) |
| 5 |
|
| 6 |
# Create a header file cblas.h for the routines called in my C programs |
| 7 |
include(CheckLanguage) |
| 8 |
check_language(Fortran) |
| 9 |
if(CMAKE_Fortran_COMPILER) |
| 10 |
enable_language(Fortran) |
| 11 |
include(FortranCInterface) |
| 12 |
## Ensure that the fortran compiler and c compiler specified are compatible |
| 13 |
FortranCInterface_VERIFY() |
| 14 |
FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/cblas_mangling.h |
| 15 |
MACRO_NAMESPACE "F77_" |
| 16 |
SYMBOL_NAMESPACE "F77_") |
| 17 |
|
| 18 |
# Check for any necessary platform specific compiler flags |
| 19 |
include(CheckLAPACKCompilerFlags) |
| 20 |
CheckLAPACKCompilerFlags() |
| 21 |
endif() |
| 22 |
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND) |
| 23 |
message(WARNING "Reverting to pre-defined include/cblas_mangling.h") |
| 24 |
configure_file(include/cblas_mangling_with_flags.h.in |
| 25 |
${LAPACK_BINARY_DIR}/include/cblas_mangling.h) |
| 26 |
endif() |
| 27 |
|
| 28 |
include(CheckCSourceCompiles) |
| 29 |
check_c_source_compiles("int __attribute__((weak)) main() {};" |
| 30 |
HAS_ATTRIBUTE_WEAK_SUPPORT) |
| 31 |
|
| 32 |
include_directories(include ${LAPACK_BINARY_DIR}/include) |
| 33 |
add_subdirectory(include) |
| 34 |
add_subdirectory(src) |
| 35 |
|
| 36 |
macro(append_subdir_files variable dirname) |
| 37 |
get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable}) |
| 38 |
foreach(depfile ${holder}) |
| 39 |
list(APPEND ${variable} "${dirname}/${depfile}") |
| 40 |
endforeach() |
| 41 |
endmacro() |
| 42 |
|
| 43 |
append_subdir_files(CBLAS_INCLUDE "include") |
| 44 |
install(FILES ${CBLAS_INCLUDE} ${LAPACK_BINARY_DIR}/include/cblas_mangling.h |
| 45 |
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} |
| 46 |
COMPONENT Development |
| 47 |
) |
| 48 |
|
| 49 |
if(BUILD_TESTING) |
| 50 |
add_subdirectory(testing) |
| 51 |
add_subdirectory(examples) |
| 52 |
endif() |
| 53 |
|
| 54 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in |
| 55 |
${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc @ONLY) |
| 56 |
install(FILES |
| 57 |
${CMAKE_CURRENT_BINARY_DIR}/${CBLASLIB}.pc |
| 58 |
DESTINATION ${PKG_CONFIG_DIR} |
| 59 |
COMPONENT Development |
| 60 |
) |
| 61 |
|
| 62 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in |
| 63 |
${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake @ONLY) |
| 64 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in |
| 65 |
${LAPACK_BINARY_DIR}/${CBLASLIB}-config.cmake @ONLY) |
| 66 |
|
| 67 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in |
| 68 |
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake @ONLY) |
| 69 |
install(FILES |
| 70 |
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CBLASLIB}-config.cmake |
| 71 |
${LAPACK_BINARY_DIR}/${CBLASLIB}-config-version.cmake |
| 72 |
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION} |
| 73 |
COMPONENT Development |
| 74 |
) |
| 75 |
|
| 76 |
install(EXPORT ${CBLASLIB}-targets |
| 77 |
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CBLASLIB}-${LAPACK_VERSION} |
| 78 |
COMPONENT Development |
| 79 |
) |