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 3.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. message(STATUS "CBLAS enable")
  2. enable_language(C)
  3. set(LAPACK_INSTALL_EXPORT_NAME cblas-targets)
  4. # Create a header file cblas.h for the routines called in my C programs
  5. include(FortranCInterface)
  6. ## Ensure that the fortran compiler and c compiler specified are compatible
  7. FortranCInterface_VERIFY()
  8. FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/cblas_mangling.h
  9. MACRO_NAMESPACE "F77_"
  10. SYMBOL_NAMESPACE "F77_")
  11. if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
  12. message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
  13. configure_file(include/lapacke_mangling_with_flags.h.in
  14. ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
  15. endif()
  16. include_directories(include ${LAPACK_BINARY_DIR}/include)
  17. add_subdirectory(include)
  18. add_subdirectory(src)
  19. macro(append_subdir_files variable dirname)
  20. get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable})
  21. foreach(depfile ${holder})
  22. list(APPEND ${variable} "${dirname}/${depfile}")
  23. endforeach()
  24. endmacro()
  25. append_subdir_files(CBLAS_INCLUDE "include")
  26. install(FILES ${CBLAS_INCLUDE} ${LAPACK_BINARY_DIR}/include/cblas_mangling.h DESTINATION include)
  27. # --------------------------------------------------
  28. if(BUILD_TESTING)
  29. add_subdirectory(testing)
  30. add_subdirectory(examples)
  31. endif()
  32. if(NOT BLAS_FOUND)
  33. set(ALL_TARGETS ${ALL_TARGETS} blas)
  34. endif()
  35. # Export cblas targets from the
  36. # install tree, if any.
  37. set(_cblas_config_install_guard_target "")
  38. if(ALL_TARGETS)
  39. install(EXPORT cblas-targets
  40. DESTINATION ${LIBRARY_DIR}/cmake/cblas-${LAPACK_VERSION})
  41. # Choose one of the cblas targets to use as a guard for
  42. # cblas-config.cmake to load targets from the install tree.
  43. list(GET ALL_TARGETS 0 _cblas_config_install_guard_target)
  44. endif()
  45. # Export cblas targets from the build tree, if any.
  46. set(_cblas_config_build_guard_target "")
  47. if(ALL_TARGETS)
  48. export(TARGETS ${ALL_TARGETS} FILE cblas-targets.cmake)
  49. # Choose one of the cblas targets to use as a guard
  50. # for cblas-config.cmake to load targets from the build tree.
  51. list(GET ALL_TARGETS 0 _cblas_config_build_guard_target)
  52. endif()
  53. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in
  54. ${LAPACK_BINARY_DIR}/cblas-config-version.cmake @ONLY)
  55. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in
  56. ${LAPACK_BINARY_DIR}/cblas-config.cmake @ONLY)
  57. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc @ONLY)
  58. install(FILES
  59. ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc
  60. DESTINATION ${PKG_CONFIG_DIR}
  61. )
  62. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in
  63. ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake @ONLY)
  64. install(FILES
  65. ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake
  66. ${LAPACK_BINARY_DIR}/cblas-config-version.cmake
  67. DESTINATION ${LIBRARY_DIR}/cmake/cblas-${LAPACK_VERSION}
  68. )
  69. #install(EXPORT cblas-targets
  70. # DESTINATION ${LIBRARY_DIR}/cmake/cblas-${LAPACK_VERSION})