Skip to content

Commit eeed198

Browse files
committed
Only enable Fortran for CBLAS if Fortran compiler is found
1 parent 583e0e2 commit eeed198

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

CBLAS/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
message(STATUS "CBLAS enabled")
22
enable_language(C)
3-
enable_language(Fortran)
43

5-
# Check for any necessary platform specific compiler flags
6-
include(CheckLAPACKCompilerFlags)
7-
CheckLAPACKCompilerFlags()
4+
include(CheckLanguage)
5+
check_language(Fortran)
6+
if(CMAKE_Fortran_COMPILER)
7+
enable_language(Fortran)
8+
9+
# Check for any necessary platform specific compiler flags
10+
include(CheckLAPACKCompilerFlags)
11+
CheckLAPACKCompilerFlags()
12+
endif()
813

914
set(LAPACK_INSTALL_EXPORT_NAME ${CBLASLIB}-targets)
1015

CBLAS/include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ endif()
4242
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
4343
message(WARNING "Reverting to pre-defined include/cblas_mangling.h")
4444
configure_file(
45-
include/cblas_mangling_with_flags.h.in
45+
cblas_mangling_with_flags.h.in
4646
${LAPACK_BINARY_DIR}/include/cblas_mangling.h)
4747
endif()
4848

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ if(NOT BLAS_FOUND)
249249
message(STATUS "Using supplied NETLIB BLAS implementation")
250250
add_subdirectory(BLAS)
251251
set(BLAS_LIBRARIES ${BLASLIB})
252-
253-
# Include cblas_f77.h and cblas_mangling.h even if CBLAS is not built
254-
add_subdirectory(CBLAS/include)
255252
else()
256253
add_link_options(${BLAS_LINKER_FLAGS})
257254
endif()
@@ -261,6 +258,11 @@ endif()
261258
# CBLAS
262259
option(CBLAS "Build CBLAS" OFF)
263260

261+
# Include cblas_f77.h and cblas_mangling.h even if CBLAS is not built
262+
if(CBLAS OR NOT BLAS_FOUND)
263+
add_subdirectory(CBLAS/include)
264+
endif()
265+
264266
if(CBLAS)
265267
add_subdirectory(CBLAS)
266268
endif()
@@ -288,7 +290,7 @@ if(LAPACK_LIBRARIES)
288290
check_language(Fortran)
289291
if(CMAKE_Fortran_COMPILER)
290292
enable_language(Fortran)
291-
include(CheckFortranFunctionExists)
293+
incldude(CheckFortranFunctionExists)
292294
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
293295
# Check if new routine of 3.4.0 is in LAPACK_LIBRARIES
294296
CHECK_FORTRAN_FUNCTION_EXISTS("dgeqrt" LATESTLAPACK_FOUND)

0 commit comments

Comments
 (0)