conan-io / conan-io/conan

[feature] Support for CMAKE_MODULE_LINKER_FLAGS

Open
#17,539 2 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
type: feature type: look into
Dominant language
Python
Stars
9.5k
Forks
1.1k
Avg merge
23h 48m
Merged PRs (30d)
15

Description

### What is your suggestion?

Conan currently only supports [`CMAKE_SHARED_LINKER_FLAGS`](https://cmake.org/cmake/help/latest/variable/CMAKE_SHARED_LINKER_FLAGS.html) and [`CMAKE_EXE_LINKER_FLAGS`](https://cmake.org/cmake/help/latest/variable/CMAKE_EXE_LINKER_FLAGS.html), but lacks support for [`CMAKE_MODULE_LINKER_FLAGS`](https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_LINKER_FLAGS.html). This causes issues when building e.g. [Python extension modules](https://cmake.org/cmake/help/latest/module/FindPython3.html#commands) and other plugins (any target created using [`add_library(tgt MODULE)`](https://cmake.org/cmake/help/latest/command/add_library.html#normal)). When a profile (or Conan itself) sets any shared linker flags, these are not applied to module targets.

In the short term, it may be easiest to just initialize the module linker flags to the same values as the shared linker flags in the CMakeToolchain generator, similar to what I've done here: https://github.com/conan-io/conan/commit/a2a8d41fb5a51879fef4b44653e1df7956f96e61
Longer-term, it would be nice to have a separate config option similar to `tools.build:sharedlinkflags` and `tools.build:exelinkflags`.

### Have you read the CONTRIBUTING guide?

- [X] I've read the CONTRIBUTING guide

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.