diff options
author | Hans Johnson <hans-johnson@uiowa.edu> | 2016-07-04 18:09:00 -0500 |
---|---|---|
committer | Hans Johnson <hans-johnson@uiowa.edu> | 2016-07-05 16:08:43 -0500 |
commit | 2cf24483240fbe5d119b8f9b172d0d0b85d78819 (patch) | |
tree | 983a154bf90aa4873e267284ae5510d35f8a8d6a /LAPACKE | |
parent | 9dd0968b2148a6f9cfdb193d9ae9a224ab28ddb7 (diff) |
COMP: Improve introspection and header configuration
Use CMake capabilities to test if the specified fortran
and C compilers are compatible. Fail early if they are
determined to be incompatible.
Use CMake capabilities to generate platform specific
header files, If CMake FortranCInterface_HEADER function
fails to identify FortranCInterface_GLOBAL_FOUND or
FortranCInterface_MODULE_FOUND, then fall back to the
statically generated file that is used by Makefiles.
Diffstat (limited to 'LAPACKE')
-rw-r--r-- | LAPACKE/CMakeLists.txt | 29 | ||||
-rw-r--r-- | LAPACKE/include/CMakeLists.txt | 2 |
2 files changed, 14 insertions, 17 deletions
diff --git a/LAPACKE/CMakeLists.txt b/LAPACKE/CMakeLists.txt index 4c61eaa0..7208d53e 100644 --- a/LAPACKE/CMakeLists.txt +++ b/LAPACKE/CMakeLists.txt @@ -3,21 +3,18 @@ enable_language(C) set(LAPACK_INSTALL_EXPORT_NAME lapacke-targets) -# Create a header file netlib.h for the routines called in my C programs +# Create a header file lapacke_mangling.h for the routines called in my C programs include(FortranCInterface) -FortranCInterface_HEADER( ${CMAKE_CURRENT_SOURCE_DIR}/include/lapacke_mangling.h - MACRO_NAMESPACE "LAPACK_" - SYMBOL_NAMESPACE "LAPACK_" ) - -# Old way to detect mangling -#include(FortranMangling) -#FORTRAN_MANGLING(CDEFS) -#set(CDEFS ${CDEFS} CACHE STRING "Fortran Mangling" FORCE) -#MESSAGE(STATUS "=========") - -# -------------------------------------------------- -# Compiler Flags -#ADD_DEFINITIONS( "-D${CDEFS}") +## Ensure that the fortran compiler and c compiler specified are compatible +FortranCInterface_VERIFY() +FortranCInterface_HEADER( ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h + MACRO_NAMESPACE "LAPACK_" + SYMBOL_NAMESPACE "LAPACK_" ) +if( NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND) + message(WARNING "Reverting to pre-defined include/lapacke_mangling.h") + configure_file( include/lapacke_mangling_with_flags.h.in + ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h ) +endif () if (WIN32 AND NOT UNIX) ADD_DEFINITIONS(-DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE) @@ -26,7 +23,7 @@ endif (WIN32 AND NOT UNIX) get_directory_property( DirDefs COMPILE_DEFINITIONS ) -include_directories( include ) +include_directories( include ${LAPACK_BINARY_DIR}/include ) add_subdirectory(include) add_subdirectory(src) add_subdirectory(utils) @@ -58,7 +55,7 @@ else (USE_XBLAS) endif(USE_XBLAS) lapack_install_library(lapacke) -INSTALL( FILES ${LAPACKE_INCLUDE} DESTINATION include ) +INSTALL( FILES ${LAPACKE_INCLUDE} ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h DESTINATION include ) if(BUILD_TESTING) add_subdirectory(example) diff --git a/LAPACKE/include/CMakeLists.txt b/LAPACKE/include/CMakeLists.txt index 80b269fb..fbcfbdd9 100644 --- a/LAPACKE/include/CMakeLists.txt +++ b/LAPACKE/include/CMakeLists.txt @@ -1,3 +1,3 @@ -SET (LAPACKE_INCLUDE lapacke.h lapacke_config.h lapacke_utils.h lapacke_mangling.h) +SET (LAPACKE_INCLUDE lapacke.h lapacke_config.h lapacke_utils.h ) file(COPY ${LAPACKE_INCLUDE} DESTINATION ${LAPACK_BINARY_DIR}/include) |