-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
category:vcpkg-featureThe issue is a new capability of the tool that doesn’t already exist and we haven’t committedThe issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Description
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
- Forward the mentioned variables from triplet to project in
scripts/cmake/vcpkg_configure_cmake.cmake
- Setup appropriate CMake variables (e.g.
CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT
andCMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT
) in toolchain files (scripts/toolchains
).
I use this approach in my Vcpkg fork, could make a PR.
Metadata
Metadata
Assignees
Labels
category:vcpkg-featureThe issue is a new capability of the tool that doesn’t already exist and we haven’t committedThe issue is a new capability of the tool that doesn’t already exist and we haven’t committed