cmake: use target_link_options() when available#17670
Closed
vszakats wants to merge 5 commits intocurl:masterfrom
Closed
cmake: use target_link_options() when available#17670vszakats wants to merge 5 commits intocurl:masterfrom
target_link_options() when available#17670vszakats wants to merge 5 commits intocurl:masterfrom
Conversation
To pass `-municode` to the linker. Before this patch we passed this via `target_link_libraries()` which is designed to pass libraries. Keep using it for old CMake versions, where no better alternative existed. https://cmake.org/cmake/help/latest/command/target_link_options.html
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
To pass `-municode` to the linker. Before this patch we passed this via `target_link_libraries()` which is designed to pass libraries. Keep using it for old CMake versions, where no better alternative existed. https://cmake.org/cmake/help/latest/command/target_link_options.html Also: - also pass `-municode` as `PRIVATE` for old cmake versions. (it should not make a difference because no target depends on the curl tool, but this seem to be the modern, non-ambiguous syntax.) - unfold a bunch of split lines for greppability of `add_library()` and `add_executable()` commands. - quote a string. Closes curl#17670
2 tasks
vszakats
added a commit
that referenced
this pull request
Sep 29, 2025
- replace `COMPILE_FLAGS` with `COMPILE_OPTIONS` that superceded it. Follow-up to 6140dfc https://cmake.org/cmake/help/v4.1/prop_sf/COMPILE_FLAGS.html - replace `target_link_libraries()` with `LINK_FLAGS` property for CMake <=3.12, because we are passing linker options (not libs). Follow-up to 91720b6 #18468 Follow-up to 5488739 #17670 Follow-up to 95aea79 #5843 https://cmake.org/cmake/help/v3.7/command/target_link_libraries.html https://cmake.org/cmake/help/v3.7/prop_tgt/LINK_FLAGS.html - replace `target_link_options()` with `LINK_OPTIONS` propery for CMake 3.13+, to use the modern style. Follow-up to 91720b6 #18468 Follow-up to 5488739 #17670 https://cmake.org/cmake/help/v3.13/command/target_link_options.html https://cmake.org/cmake/help/v3.13/prop_tgt/LINK_OPTIONS.html Also: - fix to append to, not override, previously set linker options when using `CURL_LIBCURL_VERSIONED_SYMBOLS=ON`. Before this patch, it was overwriting linker options when using `CURL_CODE_COVERAGE=ON`. Follow-up to 91720b6 #18468 Closes #18762
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To pass
-municodeto the linker. Before this patch we passed this viatarget_link_libraries()which is designed to pass libraries. Keepusing it for old CMake versions, where no better alternative existed.
https://cmake.org/cmake/help/latest/command/target_link_options.html
Also:
-municodeasPRIVATEfor old cmake versions.(it should not make a difference because no target depends on the curl
tool, but this seem to be the modern, non-ambiguous syntax.)
add_library()andadd_executable()commands.