Skip to content
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

cmake: don't include non-IMPORTED zlib target in check_library_exists. #11648

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion CMakeLists.txt
Expand Up @@ -175,6 +175,7 @@ endif()

# initialize CURL_LIBS
set(CURL_LIBS "")
set(CURL_DEPS "")

if(ENABLE_ARES)
set(USE_ARES 1)
Expand Down Expand Up @@ -540,7 +541,12 @@ if(ZLIB_FOUND)
# version of CMake. This allows our dependents to get our dependencies
# transitively.
if(NOT CMAKE_VERSION VERSION_LESS 3.4)
list(APPEND CURL_LIBS ZLIB::ZLIB)
get_target_property(_imported ZLIB::ZLIB IMPORTED)
if(_imported)
list(APPEND CURL_LIBS ZLIB::ZLIB)
else()
list(APPEND CURL_DEPS ZLIB::ZLIB)
endif()
else()
list(APPEND CURL_LIBS ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Expand Up @@ -60,7 +60,7 @@ if(ENABLE_CURLDEBUG)
# being applied to memdebug.c itself.
set_source_files_properties(memdebug.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
endif()
target_link_libraries(curlu PRIVATE ${CURL_LIBS})
target_link_libraries(curlu PRIVATE ${CURL_LIBS} ${CURL_DEPS})

transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake")
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Expand Up @@ -107,7 +107,7 @@ include_directories(
)

#Build curl executable
target_link_libraries(${EXE_NAME} ${LIB_SELECTED_FOR_EXE} ${CURL_LIBS})
target_link_libraries(${EXE_NAME} ${LIB_SELECTED_FOR_EXE} ${CURL_LIBS} ${CURL_DEPS})

################################################################################

Expand Down
2 changes: 1 addition & 1 deletion tests/libtest/CMakeLists.txt
Expand Up @@ -44,7 +44,7 @@ function(setup_test TEST_NAME) # ARGN are the files in the test
include_directories(${CARES_INCLUDE_DIR})
endif()

target_link_libraries(${TEST_NAME} ${LIB_SELECTED} ${CURL_LIBS})
target_link_libraries(${TEST_NAME} ${LIB_SELECTED} ${CURL_LIBS} ${CURL_DEPS})

set_target_properties(${TEST_NAME}
PROPERTIES COMPILE_DEFINITIONS ${UPPER_TEST_NAME})
Expand Down
2 changes: 1 addition & 1 deletion tests/server/CMakeLists.txt
Expand Up @@ -42,7 +42,7 @@ function(SETUP_EXECUTABLE TEST_NAME) # ARGN are the files in the test
include_directories(${CARES_INCLUDE_DIR})
endif()

target_link_libraries(${TEST_NAME} ${CURL_LIBS})
target_link_libraries(${TEST_NAME} ${CURL_LIBS} ${CURL_DEPS})

# Test servers simply are standalone programs that do not use libcurl
# library. For convenience and to ease portability of these servers,
Expand Down