Correct target dependencies.

And improve a variable name.
This commit is contained in:
Jim Hague 2019-10-16 10:29:29 +01:00
parent cd62f2b716
commit 55d6b47ed1
1 changed files with 11 additions and 11 deletions

View File

@ -132,9 +132,9 @@ else()
endif() endif()
# Windows. Uh-oh. # Windows. Uh-oh.
set(extra_libraries "") set(getdns_system_libs "")
if (DEFINED GETDNS_ON_WINDOWS) if (DEFINED GETDNS_ON_WINDOWS)
list(APPEND extra_libraries list(APPEND getdns_system_libs
"ws2_32" "ws2_32"
"crypt32" "crypt32"
"gdi32" "gdi32"
@ -182,7 +182,7 @@ check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)
# Check for include declarations # Check for include declarations
check_symbol_exists(getentropy unistd.h HAVE_DECL_GETENTROPY) check_symbol_exists(getentropy unistd.h HAVE_DECL_GETENTROPY)
if (DEFINED GETDNS_ON_WINDOWS) if (DEFINED GETDNS_ON_WINDOWS)
set(CMAKE_REQUIRED_LIBRARIES ${extra_libraries}) set(CMAKE_REQUIRED_LIBRARIES ${getdns_system_libs})
check_symbol_exists(inet_pton ws2tcpip.h HAVE_DECL_INET_PTON) check_symbol_exists(inet_pton ws2tcpip.h HAVE_DECL_INET_PTON)
check_symbol_exists(inet_ntop ws2tcpip.h HAVE_DECL_INET_NTOP) check_symbol_exists(inet_ntop ws2tcpip.h HAVE_DECL_INET_NTOP)
else() else()
@ -289,7 +289,7 @@ if (NOT
HAVE_ARC4RANDOM_UNIFORM AND HAVE_DECL_ARC4RANDOM_UNIFORM)) HAVE_ARC4RANDOM_UNIFORM AND HAVE_DECL_ARC4RANDOM_UNIFORM))
find_library(BSD_LIB bsd) find_library(BSD_LIB bsd)
if (BSD_LIB) if (BSD_LIB)
list(APPEND extra_libraries "bsd") list(APPEND getdns_system_libs "bsd")
set(CMAKE_REQUIRED_LIBRARIES "bsd") set(CMAKE_REQUIRED_LIBRARIES "bsd")
check_include_file(bsd/stdlib.h HAVE_BSD_STDLIB_H) check_include_file(bsd/stdlib.h HAVE_BSD_STDLIB_H)
@ -452,7 +452,8 @@ if (NOT STRPTIME_WORKS)
endif() endif()
set(getdns_INCLUDES set(getdns_INCLUDES
PRIVATE src PUBLIC src
PRIVATE src/util/auxiliary PRIVATE src/util/auxiliary
PRIVATE src/openssl PRIVATE src/openssl
PRIVATE src/tls PRIVATE src/tls
@ -467,9 +468,7 @@ set(getdns_INCLUDES
set(getdns_LIBS set(getdns_LIBS
PUBLIC ${OPENSSL_LIBRARIES} PUBLIC ${OPENSSL_LIBRARIES}
PUBLIC Threads::Threads PUBLIC Threads::Threads
PUBLIC ${LIBBSD_LDFLAGS} PUBLIC ${getdns_system_libs}
PUBLIC ${LIBBSD_LIBRARIES}
PUBLIC ${extra_libraries}
) )
if (NOT HAVE_SSL_DANE_ENABLE) if (NOT HAVE_SSL_DANE_ENABLE)
@ -490,12 +489,13 @@ set_property(TARGET getdns PROPERTY C_STANDARD 11)
add_executable(getdns_query src/tools/getdns_query.c) add_executable(getdns_query src/tools/getdns_query.c)
target_include_directories(getdns_query target_include_directories(getdns_query
PUBLIC src PRIVATE getdns
# The followingis only needed because getdns_query.c includes config.h,
# and that includes OpenSSL header files.
PRIVATE ${OPENSSL_INCLUDE_DIR} PRIVATE ${OPENSSL_INCLUDE_DIR}
) )
target_link_libraries(getdns_query target_link_libraries(getdns_query
PUBLIC getdns PRIVATE getdns
PUBLIC ${OPENSSL_LIBRARIES}
) )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/include/cmakeconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/include/cmakeconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)