Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass VCPKG_LINKER_FLAGS_<CONFIG> from triplets to ports #11129

Closed
psfrolov opened this issue May 2, 2020 · 2 comments
Closed

Pass VCPKG_LINKER_FLAGS_<CONFIG> from triplets to ports #11129

psfrolov opened this issue May 2, 2020 · 2 comments
Assignees
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@psfrolov
Copy link
Contributor

psfrolov commented May 2, 2020

Problem

Currently it is not possible to pass debug/release-specific linker flags to dynamic library builds. In practice I use release linker flags to fine-tune link-time optimisation with MSVC and Clang and debug linker flags to link with sanitiser runtimes.

Ports can use these flags via CMake built-in variables CMAKE_SHARED_LINKER_FLAGS_DEBUG and CMAKE_SHARED_LINKER_FLAGS_RELEASE. In fact, boost-modular-build for example already respects these variables while generating build config for b2). The only piece missing is to forward VCPKG_LINKER_FLAGS_RELEASE and VCPKG_LINKER_FLAGS_DEBUG variables from triplets to CMake.

Proposed solution

  1. Forward the mentioned variables from triplet to project in scripts/cmake/vcpkg_configure_cmake.cmake
  2. Setup appropriate CMake variables (e.g. CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT and CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT) in toolchain files (scripts/toolchains).

I use this approach in my Vcpkg fork, could make a PR.

@psfrolov psfrolov added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label May 2, 2020
@strega-nil
Copy link
Contributor

Please make a PR, this sounds like a great feature :)

@JackBoosY
Copy link
Contributor

Close this issue via #11290 merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

No branches or pull requests

3 participants