Skip to content

cmake: tidy up passing compiler and linker options - #1690

Closed
vszakats wants to merge 11 commits into
libssh2:masterfrom
vszakats:cmold
Closed

vszakats wants to merge 11 commits into
libssh2:masterfrom
vszakats:cmold

Conversation

@vszakats

@vszakats vszakats commented Sep 28, 2025 •

Copy link
Copy Markdown
Member

Previously on first iteration, that turned out to be a false track:

(This was wrong: COMPILE_OPTIONS is supported since
much earlier for directories and builds targets.)

COMPILE_OPTIONS requires 3.11+:
https://cmake.org/cmake/help/v3.19/prop_sf/COMPILE_OPTIONS.html

Replace it with target_compile_options() which was already used in
the code, and add_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 requires
a space-separated string of options, which is inconvenient:
https://cmake.org/cmake/help/v3.7/prop_sf/COMPILE_FLAGS.html

Follow-up to a8e4456 #1575
Follow-up to 14a709a #1686


w/o sp https://github.com/libssh2/libssh2/pull/1690/files?w=1

  • replace target_compile_options() for 3.11+ with the modern alternative.

@vszakats vszakats added the build label Sep 28, 2025
@vszakats
vszakats marked this pull request as draft September 28, 2025 00:50
@vszakats vszakats changed the title cmake: fix passing compiler options to cmake 3.10 and older [WIP] cmake: tidy up passing compiler and linker options Sep 28, 2025
@vszakats
vszakats marked this pull request as ready for review September 28, 2025 23:01
@vszakats vszakats changed the title [WIP] cmake: tidy up passing compiler and linker options cmake: tidy up passing compiler and linker options Sep 28, 2025
@vszakats vszakats closed this in 61d51cb Sep 29, 2025
@vszakats
vszakats deleted the cmold branch September 29, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant