-
-
Notifications
You must be signed in to change notification settings - Fork 7k
cmake: use more COMPILER_OPTIONS, LINK_OPTIONS / LINK_FLAGS
#18762
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
Conversation
Ref: https://github.com/curl/curl/actions/runs/18072632773/job/51424653376#step:5:559 It surprised me is that 3.7.2 does seem to understand the
I'm not sure why it wasn't documented till 3.11, or if there is more subtlety here. Ref: #18764 (comment): FTR |
|
Right, it's documented for 3.7.x on these links: 3.11 likely added support for it as source file properties. |
Follow-up to 45f7cb7 curl#16238
keep the old code for old cmake, the prop method would need a space-separated string
COMPILER_OPTIONS, LINK_OPTIONS / LINK_FLAGS
replace
COMPILE_FLAGSwithCOMPILE_OPTIONSthat superceded it.Follow-up to 6140dfc
https://cmake.org/cmake/help/v4.1/prop_sf/COMPILE_FLAGS.html
replace
target_link_libraries()withLINK_FLAGSproperty forCMake <=3.12, because we are passing linker options (not libs).
Follow-up to 91720b6 cmake: add
CURL_CODE_COVERAGEoption #18468Follow-up to 5488739 cmake: use
target_link_options()when available #17670Follow-up to 95aea79 CMake: add option to enable Unicode on Windows #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()withLINK_OPTIONSpropery forCMake 3.13+, to use the modern style.
Follow-up to 91720b6 cmake: add
CURL_CODE_COVERAGEoption #18468Follow-up to 5488739 cmake: use
target_link_options()when available #17670https://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 wasoverwriting linker options when using
CURL_CODE_COVERAGE=ON.Follow-up to 91720b6 cmake: add
CURL_CODE_COVERAGEoption #18468LINK_FLAGSin place oftarget_link_libraries()for old cmakeThis started out as this modification, before settling to be a simple
tidy-up:
cmake: fix passing compiler options to cmake 3.10 and older
COMPILE_OPTIONSrequires 3.11+:https://cmake.org/cmake/help/v3.19/prop_sf/COMPILE_OPTIONS.html
Replace it with
target_compile_options(), andadd_compile_options():https://cmake.org/cmake/help/v3.7/command/target_compile_options.html
https://cmake.org/cmake/help/v3.7/command/add_compile_options.html
Another alternative would be to use
COMPILE_FLAGS, but it requiresa space-separated string of options, which is inconvenient:
https://cmake.org/cmake/help/v3.7/prop_sf/COMPILE_FLAGS.html
Also:
COMPILE_FLAGSwith modern alternatve when possible,and switch to
target_compile_options()for old versions.target_link_options()withLINK_OPTIONSon moderncmake.
Follow-up to 91720b6 #18468
Follow-up to 80f9dd0 #17523
Follow-up to e865420 #17047
Follow-up to 45f7cb7 #16238
w/o sp https://github.com/curl/curl/pull/18762/files?w=1
E.g.
target_compile_options()could be used for new cmake too,but goes against the general direction to use props.
Perhaps also stick with
target_link_options()for 3.13+. [NOT NEEDED]