Fix typo
[platform/upstream/lapack.git] / CBLAS / CMakeLists.txt
1 message(STATUS "CBLAS enable")
2 enable_language(C)
3
4 set(LAPACK_INSTALL_EXPORT_NAME cblas-targets)
5
6 # Create a header file cblas.h for the routines called in my C programs
7 include(FortranCInterface)
8 FortranCInterface_HEADER( ${CMAKE_CURRENT_SOURCE_DIR}/include/cblas_mangling.h 
9                           MACRO_NAMESPACE "F77_"
10                           SYMBOL_NAMESPACE "F77_" )
11
12 # Old way to detect mangling
13 #include(FortranMangling)
14 #FORTRAN_MANGLING(CDEFS)
15 #set(CDEFS ${CDEFS} CACHE STRING "Fortran Mangling" FORCE)
16 #MESSAGE(STATUS "=========")
17
18 # --------------------------------------------------
19 # Compiler Flags
20 #ADD_DEFINITIONS( "-D${CDEFS}")
21
22
23 include_directories( include )
24 add_subdirectory(include)
25 add_subdirectory(src)
26
27 macro(append_subdir_files variable dirname)
28 get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable})
29 foreach(depfile ${holder})
30   list(APPEND ${variable} "${dirname}/${depfile}")
31 endforeach()
32 endmacro()
33
34 append_subdir_files(CBLAS_INCLUDE "include")
35 INSTALL( FILES ${CBLAS_INCLUDE} DESTINATION include )
36
37 # --------------------------------------------------
38 if(BUILD_TESTING)
39    add_subdirectory(testing)
40    add_subdirectory(examples)
41 endif(BUILD_TESTING)
42
43 if(NOT BLAS_FOUND)
44   set(ALL_TARGETS ${ALL_TARGETS} blas)
45 endif(NOT BLAS_FOUND)
46
47 # Export cblas targets from the
48 # install tree, if any.
49 set(_cblas_config_install_guard_target "")
50 if(ALL_TARGETS)
51   install(EXPORT cblas-targets
52     DESTINATION lib/cmake/cblas-${LAPACK_VERSION})
53   # Choose one of the cblas targets to use as a guard for
54   # cblas-config.cmake to load targets from the install tree.
55   list(GET ALL_TARGETS 0 _cblas_config_install_guard_target)
56 endif()
57
58 # Export cblas targets from the build tree, if any.
59 set(_cblas_config_build_guard_target "")
60 if(ALL_TARGETS)
61   export(TARGETS ${ALL_TARGETS} FILE cblas-targets.cmake)
62
63   # Choose one of the cblas targets to use as a guard
64   # for cblas-config.cmake to load targets from the build tree.
65   list(GET ALL_TARGETS 0 _cblas_config_build_guard_target)
66 endif()
67
68 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in
69   ${LAPACK_BINARY_DIR}/cblas-config-version.cmake @ONLY)
70 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in
71   ${LAPACK_BINARY_DIR}/cblas-config.cmake @ONLY)
72
73
74 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc)
75   install(FILES
76   ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc
77   DESTINATION ${PKG_CONFIG_DIR}
78    )
79
80 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in
81   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake @ONLY)
82 install(FILES
83   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake
84   ${LAPACK_BINARY_DIR}/cblas-config-version.cmake
85   DESTINATION lib/cmake/cblas-${LAPACK_VERSION}
86   )
87
88 #install(EXPORT cblas-targets
89 #  DESTINATION lib/cmake/cblas-${LAPACK_VERSION})
90