Fixed windows overlinking.

This commit is contained in:
Armin Novak 2019-03-15 11:36:24 +01:00
parent 7abc86ffae
commit 8e0565b2bd
17 changed files with 47 additions and 42 deletions

View File

@ -19,7 +19,8 @@ include(CheckFunctionExists)
set(WINPR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(WINPR_SRCS "")
set(WINPR_LIBS "")
set(WINPR_LIBS_PRIVATE "")
set(WINPR_LIBS_PUBLIC "")
set(WINPR_INCLUDES "")
set(WINPR_DEFINITIONS "")
@ -55,11 +56,18 @@ macro (winpr_include_directory_add)
endif()
endmacro()
macro (winpr_library_add)
macro (winpr_library_add_private)
foreach (_lib ${ARGN})
list (APPEND WINPR_LIBS "${_lib}")
list (APPEND WINPR_LIBS_PRIVATE "${_lib}")
endforeach()
set (WINPR_LIBS ${WINPR_LIBS} PARENT_SCOPE)
set (WINPR_LIBS_PRIVATE ${WINPR_LIBS_PRIVATE} PARENT_SCOPE)
endmacro()
macro (winpr_library_add_public)
foreach (_lib ${ARGN})
list (APPEND WINPR_LIBS_PUBLIC "${_lib}")
endforeach()
set (WINPR_LIBS_PUBLIC ${WINPR_LIBS_PUBLIC} PARENT_SCOPE)
endmacro()
macro (winpr_definition_add)
@ -76,11 +84,11 @@ check_function_exists(timer_settime TIMER_SETTIME)
check_function_exists(timer_gettime TIMER_GETTIME)
if (TIMER_CREATE AND TIMER_DELETE AND TIMER_SETTIME AND TIMER_GETTIME)
add_definitions(-DWITH_POSIX_TIMER)
winpr_library_add(rt)
winpr_library_add_private(rt)
endif()
if (ANDROID)
winpr_library_add(log)
winpr_library_add_private(log)
endif()
# Level "1" API as defined for MinCore.lib
@ -103,7 +111,8 @@ endforeach()
set(MODULE_NAME winpr)
list(REMOVE_DUPLICATES WINPR_DEFINITIONS)
list(REMOVE_DUPLICATES WINPR_LIBS)
list(REMOVE_DUPLICATES WINPR_LIBS_PRIVATE)
list(REMOVE_DUPLICATES WINPR_LIBS_PUBLIC)
list(REMOVE_DUPLICATES WINPR_INCLUDES)
include_directories(${WINPR_INCLUDES})
@ -121,7 +130,7 @@ if (WIN32)
@ONLY)
set (WINPR_SRCS ${WINPR_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
list(APPEND WINPR_LIBS "shlwapi")
winpr_library_add_public("shlwapi")
endif()
add_library(${MODULE_NAME} ${WINPR_SRCS})
@ -132,11 +141,7 @@ if (WITH_LIBRARY_VERSIONING)
endif()
add_definitions(${WINPR_DEFINITIONS})
if (WIN32)
target_link_libraries(${MODULE_NAME} ${PUBLIC_KEYWORD} ${WINPR_LIBS})
else()
target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${WINPR_LIBS})
endif(WIN32)
target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${WINPR_LIBS_PRIVATE} ${PUBLIC_KEYWORD} ${WINPR_LIBS_PUBLIC})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT WinPRTargets)
if (WITH_DEBUG_SYMBOLS AND MSVC AND BUILD_SHARED_LIBS)
get_target_property(OUTPUT_FILENAME ${MODULE_NAME} OUTPUT_NAME)

View File

@ -18,7 +18,7 @@
winpr_module_add(credui.c)
if(WIN32)
winpr_library_add(credui)
winpr_library_add_public(credui)
endif()
if(BUILD_TESTING)

View File

@ -31,7 +31,7 @@ endif(NOT WITH_ICU)
if (WITH_ICU)
find_package(ICU REQUIRED i18n uc io)
include_directories(${ICU_INCLUDE_DIRS})
winpr_library_add(${ICU_LIBRARIES})
winpr_library_add_private(${ICU_LIBRARIES})
endif (WITH_ICU)
winpr_module_add(${CRT_FILES})

View File

@ -25,16 +25,16 @@ winpr_module_add(
if(OPENSSL_FOUND)
winpr_include_directory_add(${OPENSSL_INCLUDE_DIR})
winpr_library_add(${OPENSSL_LIBRARIES})
winpr_library_add_private(${OPENSSL_LIBRARIES})
endif()
if(MBEDTLS_FOUND)
winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR})
winpr_library_add(${MBEDTLS_LIBRARIES})
winpr_library_add_private(${MBEDTLS_LIBRARIES})
endif()
if(WIN32)
winpr_library_add(crypt32)
winpr_library_add_public(crypt32)
endif()
if(BUILD_TESTING)

View File

@ -18,7 +18,7 @@
winpr_module_add(dsparse.c)
if(WIN32)
winpr_library_add(ntdsapi)
winpr_library_add_public(ntdsapi)
endif()
if(BUILD_TESTING)

View File

@ -19,5 +19,5 @@
winpr_module_add(handle.c handle.h nonehandle.c nonehandle.h)
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
winpr_library_add(rt)
winpr_library_add_private(rt)
endif()

View File

@ -18,7 +18,7 @@
winpr_module_add(locale.c)
if(WIN32)
winpr_library_add(ntdsapi)
winpr_library_add_public(ntdsapi)
endif()
if(BUILD_TESTING)

View File

@ -17,12 +17,12 @@
winpr_module_add(nt.c)
winpr_library_add(
winpr_library_add_private(
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS})
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
winpr_library_add(rt)
winpr_library_add_private(rt)
endif()
if(BUILD_TESTING)

View File

@ -26,12 +26,12 @@ winpr_module_add(
callback.c
callback_cleanup.c)
winpr_library_add(
winpr_library_add_private(
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS})
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
winpr_library_add(rt)
winpr_library_add_private(rt)
endif()
if(BUILD_TESTING)

View File

@ -40,8 +40,8 @@ winpr_module_add(
winpr_include_directory_add(${OPENSSL_INCLUDE_DIR})
winpr_library_add(${OPENSSL_LIBRARIES})
winpr_library_add_private(${OPENSSL_LIBRARIES})
if(WIN32)
winpr_library_add(ws2_32 rpcrt4)
winpr_library_add_public(ws2_32 rpcrt4)
endif()

View File

@ -42,7 +42,7 @@ endif()
winpr_module_add(${${MODULE_PREFIX}_SRCS})
if(PCSC_WINPR_FOUND)
winpr_library_add(${PCSC_WINPR_LIBRARY})
winpr_library_add_private(${PCSC_WINPR_LIBRARY})
endif()
if(BUILD_TESTING)

View File

@ -63,21 +63,21 @@ winpr_module_add(${${MODULE_PREFIX}_CREDSSP_SRCS}
if(OPENSSL_FOUND)
winpr_include_directory_add(${OPENSSL_INCLUDE_DIR})
winpr_library_add(${OPENSSL_LIBRARIES})
winpr_library_add_private(${OPENSSL_LIBRARIES})
endif()
if(MBEDTLS_FOUND)
winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR})
winpr_library_add(${MBEDTLS_LIBRARIES})
winpr_library_add_private(${MBEDTLS_LIBRARIES})
endif()
if(GSS_FOUND)
winpr_include_directory_add(${GSS_INCLUDE_DIR})
winpr_library_add(${GSS_LIBRARIES})
winpr_library_add_private(${GSS_LIBRARIES})
endif()
if(WIN32)
winpr_library_add(ws2_32)
winpr_library_add_public(ws2_32)
endif()
if(BUILD_TESTING)

View File

@ -32,7 +32,7 @@ winpr_module_add(
if(FREEBSD)
winpr_include_directory_add(${EPOLLSHIM_INCLUDE_DIR})
winpr_library_add(${EPOLLSHIM_LIBS})
winpr_library_add_private(${EPOLLSHIM_LIBS})
endif()
if(BUILD_TESTING)

View File

@ -22,7 +22,7 @@ endif()
winpr_module_add(sysinfo.c)
if((NOT WIN32) AND (NOT APPLE) AND (NOT ANDROID) AND (NOT OPENBSD))
winpr_library_add(rt)
winpr_library_add_private(rt)
endif()
if(BUILD_TESTING)

View File

@ -24,7 +24,7 @@ winpr_module_add(
tls.c)
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
winpr_library_add(rt)
winpr_library_add_private(rt)
endif()
if(BUILD_TESTING)

View File

@ -66,7 +66,7 @@ if (LIBSYSTEMD_FOUND)
)
winpr_include_directory_add(${LIBSYSTEMD_INCLUDE_DIR})
winpr_library_add(${LIBSYSTEMD_LIBRARY})
winpr_library_add_private(${LIBSYSTEMD_LIBRARY})
endif()
set(${MODULE_PREFIX}_WLOG_SRCS
@ -130,24 +130,24 @@ winpr_include_directory_add(
if(OPENSSL_FOUND)
winpr_include_directory_add(${OPENSSL_INCLUDE_DIR})
winpr_library_add(${OPENSSL_LIBRARIES})
winpr_library_add_private(${OPENSSL_LIBRARIES})
endif()
if(MBEDTLS_FOUND)
winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR})
winpr_library_add(${MBEDTLS_LIBRARIES})
winpr_library_add_private(${MBEDTLS_LIBRARIES})
endif()
if(UNIX)
winpr_library_add(m)
winpr_library_add_private(m)
endif()
if((FREEBSD) AND (NOT KFREEBSD))
winpr_library_add(execinfo)
winpr_library_add_private(execinfo)
endif()
if(WIN32)
winpr_library_add(dbghelp)
winpr_library_add_public(dbghelp)
endif()
if(BUILD_TESTING)

View File

@ -18,5 +18,5 @@
winpr_module_add(winsock.c)
if(WIN32)
winpr_library_add(ws2_32)
winpr_library_add_public(ws2_32)
endif()