mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-04 04:03:22 +03:00
LLVMFlang: Fix Fortran shared library creation on Apple platforms
LLVMFlang requires Apple-specific linker options to be forwarded through `-Xlinker`. Fixes: #27558
This commit is contained in:
1 parent
de8a69ce2d
commit
18d65b9d4b
2 files changed
+12
No files matched your search
@@ -0,0 +1,9 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
# LLVM Flang requires Darwin linker flags to be passed through its linker
|
||||
# wrapper rather than directly to the compiler driver.
|
||||
set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-Xlinker -compatibility_version -Xlinker ")
|
||||
set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-Xlinker -current_version -Xlinker ")
|
||||
set(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS "-Xlinker -bundle")
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Xlinker -install_name -Xlinker ")
|
||||
@@ -48,6 +48,9 @@ endif()
|
||||
|
||||
add_library(hello STATIC hello.f)
|
||||
add_library(world ${_SHARED} world.f ${world_def})
|
||||
if(APPLE AND CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
|
||||
set_target_properties(world PROPERTIES VERSION 1.2.3 SOVERSION 1)
|
||||
endif()
|
||||
add_executable(testf testf.f)
|
||||
target_link_libraries(testf hello world)
|
||||
|
||||
|
||||
Reference in new issue
Block a user