# Darwin.cmake and Fortran Linker

**URL:** https://discourse.cmake.org/t/darwin-cmake-and-fortran-linker/1308
**Category:** Development
**Created:** [June 2, 2020, 7:38pm UTC](https://discourse.cmake.org/t/darwin-cmake-and-fortran-linker/1308 "2020-06-02T19:38:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Anthony\_Zukaitis](https://discourse.cmake.org/user_avatar/discourse.cmake.org/anthony_zukaitis/32/499_2.png) [@Anthony\_Zukaitis](https://discourse.cmake.org/u/Anthony_Zukaitis)
#### Post date: [June 2, 2020, 7:38pm UTC](https://discourse.cmake.org/t/darwin-cmake-and-fortran-linker/1308/1 "2020-06-02T19:38:46Z")

</div>

We are seeing an issue using Intel Fortran and Fortran as the Linker Languge. We came across the issue where we wanted to add the headerpad\_max\_install\_names flag to the linker. In the Darwin.cmake file, Fortran is ignored… was this just overlooked?

Darwin.cmake:

```auto
foreach(lang C CXX OBJC OBJCXX)
  set(CMAKE_${lang}_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
  set(CMAKE_${lang}_OSX_CURRENT_VERSION_FLAG "-current_version ")
  set(CMAKE_${lang}_LINK_FLAGS "-Wl,-headerpad_max_install_names")

  if(HAVE_FLAG_SEARCH_PATHS_FIRST)
    set(CMAKE_${lang}_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_${lang}_LINK_FLAGS}")
  endif()

  set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
  set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
  set(CMAKE_SHARED_MODULE_LOADER_${lang}_FLAG "-Wl,-bundle_loader,")
endforeach()

```

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [June 3, 2020, 9:50am UTC](https://discourse.cmake.org/t/darwin-cmake-and-fortran-linker/1308/2 "2020-06-03T09:50:02Z")

</div>

Actually all the settings in that loop are potentially language- and/or compile-specific and should not be in `Darwin.cmake` at all. They should be over in `Modules/Platform/Apple-<id>-<lang>.cmake` but have not been fully refactored. In the case of Intel Fortran, they should go in `Modules/Platform/Apple-Intel-Fortran.cmake` or the macro it invokes.
