Skip to content

Commit 09cbd41

Browse files
committed
only set linker_language when needed
1 parent b237241 commit 09cbd41

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

cmake/compilers.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ include(CheckIncludeFile)
22
include(CheckSymbolExists)
33
include(CheckIncludeFileCXX)
44

5+
set(linker_lang)
56
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_GENERATOR STREQUAL "Unix Makefiles")
67
# otherwise failed to link since -lc++ is missing
78
set(linker_lang CXX)
8-
message(VERBOSE "Setting linker language to CXX for certain targets")
9-
elseif(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
10-
# IntelLLVM|NVHPC need Fortran.
11-
# For other compilers (except as above) don't need it set, but Fortran doesn't hurt.
9+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM|NVHPC" AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
10+
# IntelLLVM|NVHPC need Fortran
1211
set(linker_lang Fortran)
13-
message(VERBOSE "Setting linker language to Fortran for certain targets")
12+
endif()
13+
if(linker_lang)
14+
message(STATUS "Setting linker language to ${linker_lang} for certain targets")
1415
endif()
1516

1617
# --- abi check: C++ and Fortran compiler ABI compatibility

0 commit comments

Comments
 (0)