Skip to content

Commit f8f6e31

Browse files
Solve a few bugs generated in the previous commit
1 parent f279210 commit f8f6e31

File tree

4 files changed

+42
-29
lines changed

4 files changed

+42
-29
lines changed

CBLAS/CMakeLists.txt

+11-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ enable_language(C)
44
set(LAPACK_INSTALL_EXPORT_NAME ${CBLASLIB}-targets)
55

66
# 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_")
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+
endif()
1318
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
1419
message(WARNING "Reverting to pre-defined include/cblas_mangling.h")
1520
configure_file(include/cblas_mangling_with_flags.h.in

CMakeLists.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,15 @@ endif()
362362
set(LAPACK_INSTALL_EXPORT_NAME ${LAPACK_INSTALL_EXPORT_NAME_CACHE})
363363
unset(LAPACK_INSTALL_EXPORT_NAME_CACHE)
364364

365-
add_subdirectory(LAPACKE)
365+
366+
#-------------------------------------
367+
# LAPACKE
368+
# Include lapack.h and lapacke_mangling.h even if LAPACKE is not built
369+
add_subdirectory(LAPACKE/include)
370+
371+
if(LAPACKE)
372+
add_subdirectory(LAPACKE)
373+
endif()
366374

367375

368376
#-------------------------------------

LAPACKE/CMakeLists.txt

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
1-
# Create a header file lapacke_mangling.h for the routines called in my C programs
2-
include(FortranCInterface)
3-
## Ensure that the fortran compiler and c compiler specified are compatible
4-
FortranCInterface_VERIFY()
5-
FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/lapacke_mangling.h
6-
MACRO_NAMESPACE "LAPACK_"
7-
SYMBOL_NAMESPACE "LAPACK_")
8-
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
9-
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
10-
configure_file(include/lapacke_mangling_with_flags.h.in
11-
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
12-
endif()
13-
14-
add_subdirectory(include)
15-
16-
17-
if(NOT LAPACKE)
18-
return()
19-
endif()
20-
21-
221
message(STATUS "LAPACKE enabled")
232
enable_language(C)
243

4+
add_subdirectory(include)
5+
256
set(LAPACK_INSTALL_EXPORT_NAME ${LAPACKELIB}-targets)
267

278
include_directories(include ${LAPACK_BINARY_DIR}/include)

LAPACKE/include/CMakeLists.txt

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11
set(LAPACKE_INCLUDE lapack.h)
2-
32
IF(LAPACKE)
43
list(APPEND LAPACKE_INCLUDE lapacke.h lapacke_config.h lapacke_utils.h)
54
endif()
65

76
file(COPY ${LAPACKE_INCLUDE} DESTINATION ${LAPACK_BINARY_DIR}/include)
7+
8+
# Create a header file lapacke_mangling.h for the routines called in my C programs
9+
include(CheckLanguage)
10+
check_language(Fortran)
11+
check_language(C)
12+
if(CMAKE_Fortran_COMPILER AND CMAKE_C_COMPILER)
13+
enable_language(Fortran)
14+
enable_language(C)
15+
include(FortranCInterface)
16+
## Ensure that the fortran compiler and c compiler specified are compatible
17+
FortranCInterface_VERIFY()
18+
FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/lapacke_mangling.h
19+
MACRO_NAMESPACE "LAPACK_"
20+
SYMBOL_NAMESPACE "LAPACK_")
21+
endif()
22+
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
23+
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
24+
configure_file(lapacke_mangling_with_flags.h.in
25+
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
26+
endif()

0 commit comments

Comments
 (0)