Skip to content

Commit 7e680b2

Browse files
committed
correct linker language logic for null pointer
1 parent ee32801 commit 7e680b2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cmake/compilers.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ include(CheckIncludeFile)
22
include(CheckSymbolExists)
33
include(CheckIncludeFileCXX)
44

5-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24 AND CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_GENERATOR STREQUAL "Unix Makefiles")
5+
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_GENERATOR STREQUAL "Unix Makefiles")
66
# otherwise failed to link since -lc++ is missing
77
set(linker_lang CXX)
8+
message(VERBOSE "Setting linker language to CXX for certain targets")
89
elseif(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
910
# IntelLLVM|NVHPC need Fortran.
1011
# For other compilers (except as above) don't need it set, but Fortran doesn't hurt.
1112
set(linker_lang Fortran)
13+
message(VERBOSE "Setting linker language to Fortran for certain targets")
1214
endif()
1315

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

test/pointer/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ add_test(NAME Fortran_C++_null COMMAND fortran_cxx_null)
2626
# for Visual Studio generator object library
2727
add_library(c_null OBJECT ${PROJECT_SOURCE_DIR}/src/pointer/null.c)
2828
add_executable(fortran_c_null null_c.f90 $<TARGET_OBJECTS:c_null>)
29+
set_property(TARGET fortran_c_null PROPERTY LINKER_LANGUAGE Fortran)
2930
add_test(NAME Fortran_C_null COMMAND fortran_c_null)
30-
31-
set_property(TARGET fortran_c_null fortran_cxx_null PROPERTY LINKER_LANGUAGE Fortran)

0 commit comments

Comments
 (0)