STYLE: Remove trailing whitespace in CMake files
[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 ## Ensure that the fortran compiler and c compiler specified are compatible
9 FortranCInterface_VERIFY()
10 FortranCInterface_HEADER( ${LAPACK_BINARY_DIR}/include/cblas_mangling.h
11                           MACRO_NAMESPACE "F77_"
12                           SYMBOL_NAMESPACE "F77_" )
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 )
17 endif ()
18
19 include_directories( include ${LAPACK_BINARY_DIR}/include )
20 add_subdirectory(include)
21 add_subdirectory(src)
22
23 macro(append_subdir_files variable dirname)
24 get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable})
25 foreach(depfile ${holder})
26   list(APPEND ${variable} "${dirname}/${depfile}")
27 endforeach()
28 endmacro()
29
30 append_subdir_files(CBLAS_INCLUDE "include")
31 INSTALL( FILES ${CBLAS_INCLUDE} ${LAPACK_BINARY_DIR}/include/cblas_mangling.h DESTINATION include )
32
33 # --------------------------------------------------
34 if(BUILD_TESTING)
35    add_subdirectory(testing)
36    add_subdirectory(examples)
37 endif(BUILD_TESTING)
38
39 if(NOT BLAS_FOUND)
40   set(ALL_TARGETS ${ALL_TARGETS} blas)
41 endif(NOT BLAS_FOUND)
42
43 # Export cblas targets from the
44 # install tree, if any.
45 set(_cblas_config_install_guard_target "")
46 if(ALL_TARGETS)
47   install(EXPORT cblas-targets
48     DESTINATION lib/cmake/cblas-${LAPACK_VERSION})
49   # Choose one of the cblas targets to use as a guard for
50   # cblas-config.cmake to load targets from the install tree.
51   list(GET ALL_TARGETS 0 _cblas_config_install_guard_target)
52 endif()
53
54 # Export cblas targets from the build tree, if any.
55 set(_cblas_config_build_guard_target "")
56 if(ALL_TARGETS)
57   export(TARGETS ${ALL_TARGETS} FILE cblas-targets.cmake)
58
59   # Choose one of the cblas targets to use as a guard
60   # for cblas-config.cmake to load targets from the build tree.
61   list(GET ALL_TARGETS 0 _cblas_config_build_guard_target)
62 endif()
63
64 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-version.cmake.in
65   ${LAPACK_BINARY_DIR}/cblas-config-version.cmake @ONLY)
66 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-build.cmake.in
67   ${LAPACK_BINARY_DIR}/cblas-config.cmake @ONLY)
68
69
70 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cblas.pc.in ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc)
71   install(FILES
72   ${CMAKE_CURRENT_BINARY_DIR}/cblas.pc
73   DESTINATION ${PKG_CONFIG_DIR}
74    )
75
76 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cblas-config-install.cmake.in
77   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake @ONLY)
78 install(FILES
79   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cblas-config.cmake
80   ${LAPACK_BINARY_DIR}/cblas-config-version.cmake
81   DESTINATION lib/cmake/cblas-${LAPACK_VERSION}
82   )
83
84 #install(EXPORT cblas-targets
85 #  DESTINATION lib/cmake/cblas-${LAPACK_VERSION})
86