mirror of
https://github.com/curl/curl.git
synced 2026-08-26 12:23:34 +03:00
cmake: omit linking duplicate/unnecessary libs to tests & examples
Before this patch we explicitly linked the full list of libcurl dependency libs to tests and examples via `CURL_LIBS`. This was redundant, because test and example code do not directly use these dependency libs and for indirect use they are implicitly passed via libcurl as needed. After this patch, tests and examples only link explicitly to system libs (e.g. socket). Also bringing it closer to how `./configure` does this. Borrow the variable name `CURL_NETWORK_AND_TIME_LIBS` from `./configure`. However, its content is not exactly the same. With cmake it also holds `pthread`, but doesn't hold AmiSSL. Closes #17696
This commit is contained in:
parent
8e1d817cb3
commit
58b9c6134b
5 changed files with 14 additions and 11 deletions
|
|
@ -32,7 +32,7 @@ foreach(_target IN LISTS check_PROGRAMS)
|
|||
set(_target_name "curl-example-${_target}")
|
||||
add_executable(${_target_name} EXCLUDE_FROM_ALL "${_target}.c")
|
||||
add_dependencies(curl-examples ${_target_name})
|
||||
target_link_libraries(${_target_name} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
target_link_libraries(${_target_name} ${LIB_SELECTED} ${CURL_NETWORK_AND_TIME_LIBS})
|
||||
target_compile_definitions(${_target_name} PRIVATE "CURL_NO_OLDIES" "$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>")
|
||||
set_target_properties(${_target_name} PROPERTIES OUTPUT_NAME "${_target}" PROJECT_LABEL "Example ${_target}" UNITY_BUILD OFF)
|
||||
endforeach()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue