1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-10-24 14:53:03 +03:00

cmake: tidy up passing compiler and linker options

- prefer `set_property()` over `target_compile_options()`, to use
  the modern style.

  Follow-up to 8017592163 #939

- prefer to append to compiler/linker options in examples/tests.
  To prevent accidentally overriding a previously set option.

  Follow-up to 14a709a72f #1686
  Follow-up to 854cfa8292 #1524

- replace `LINK_FLAGS` with `LINK_OPTIONS` that superceded it, for
  CMake 3.13+.

  Follow-up to 854cfa8292 #1524
  https://cmake.org/cmake/help/v4.1/prop_tgt/LINK_OPTIONS.html

Closes #1690
This commit is contained in:
Viktor Szakats
2025-09-28 02:04:32 +02:00
parent a7b3fdb416
commit 61d51cb449
4 changed files with 12 additions and 6 deletions

View File

@@ -52,7 +52,8 @@ foreach(_example IN LISTS noinst_PROGRAMS)
"${PROJECT_BINARY_DIR}/src"
"${PROJECT_SOURCE_DIR}/src")
target_link_libraries(${_example} ${LIB_SELECTED} ${LIBSSH2_LIBS})
set_target_properties(${_example} PROPERTIES COMPILE_OPTIONS "${LIBSSH2_PICKY_C_FLAGS}" UNITY_BUILD OFF)
set_property(TARGET ${_example} APPEND PROPERTY COMPILE_OPTIONS "${LIBSSH2_PICKY_C_FLAGS}")
set_target_properties(${_example} PROPERTIES UNITY_BUILD OFF)
endforeach()
libssh2_add_target_to_copy_dependencies(