diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index ff29801f0..62766c806 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/credui/CMakeLists.txt b/winpr/libwinpr/credui/CMakeLists.txt index b1a06638f..b01be1d97 100644 --- a/winpr/libwinpr/credui/CMakeLists.txt +++ b/winpr/libwinpr/credui/CMakeLists.txt @@ -18,7 +18,7 @@ winpr_module_add(credui.c) if(WIN32) - winpr_library_add(credui) + winpr_library_add_public(credui) endif() if(BUILD_TESTING) diff --git a/winpr/libwinpr/crt/CMakeLists.txt b/winpr/libwinpr/crt/CMakeLists.txt index 678f93713..a2d0dda3e 100644 --- a/winpr/libwinpr/crt/CMakeLists.txt +++ b/winpr/libwinpr/crt/CMakeLists.txt @@ -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}) diff --git a/winpr/libwinpr/crypto/CMakeLists.txt b/winpr/libwinpr/crypto/CMakeLists.txt index 8f3418a5f..d215744c7 100644 --- a/winpr/libwinpr/crypto/CMakeLists.txt +++ b/winpr/libwinpr/crypto/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/dsparse/CMakeLists.txt b/winpr/libwinpr/dsparse/CMakeLists.txt index 0703523a7..e455ccc78 100644 --- a/winpr/libwinpr/dsparse/CMakeLists.txt +++ b/winpr/libwinpr/dsparse/CMakeLists.txt @@ -18,7 +18,7 @@ winpr_module_add(dsparse.c) if(WIN32) - winpr_library_add(ntdsapi) + winpr_library_add_public(ntdsapi) endif() if(BUILD_TESTING) diff --git a/winpr/libwinpr/handle/CMakeLists.txt b/winpr/libwinpr/handle/CMakeLists.txt index 09ea2f13d..37c410ea1 100644 --- a/winpr/libwinpr/handle/CMakeLists.txt +++ b/winpr/libwinpr/handle/CMakeLists.txt @@ -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() diff --git a/winpr/libwinpr/locale/CMakeLists.txt b/winpr/libwinpr/locale/CMakeLists.txt index 826ea68c9..df5d72c9a 100644 --- a/winpr/libwinpr/locale/CMakeLists.txt +++ b/winpr/libwinpr/locale/CMakeLists.txt @@ -18,7 +18,7 @@ winpr_module_add(locale.c) if(WIN32) - winpr_library_add(ntdsapi) + winpr_library_add_public(ntdsapi) endif() if(BUILD_TESTING) diff --git a/winpr/libwinpr/nt/CMakeLists.txt b/winpr/libwinpr/nt/CMakeLists.txt index e2988cf42..663e00df4 100644 --- a/winpr/libwinpr/nt/CMakeLists.txt +++ b/winpr/libwinpr/nt/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/pool/CMakeLists.txt b/winpr/libwinpr/pool/CMakeLists.txt index acd27c48e..2e25916a2 100644 --- a/winpr/libwinpr/pool/CMakeLists.txt +++ b/winpr/libwinpr/pool/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/rpc/CMakeLists.txt b/winpr/libwinpr/rpc/CMakeLists.txt index 6e1b2aca0..538ec400c 100644 --- a/winpr/libwinpr/rpc/CMakeLists.txt +++ b/winpr/libwinpr/rpc/CMakeLists.txt @@ -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() diff --git a/winpr/libwinpr/smartcard/CMakeLists.txt b/winpr/libwinpr/smartcard/CMakeLists.txt index 154e3e81b..5d67ec4e0 100644 --- a/winpr/libwinpr/smartcard/CMakeLists.txt +++ b/winpr/libwinpr/smartcard/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/sspi/CMakeLists.txt b/winpr/libwinpr/sspi/CMakeLists.txt index 597e0957d..fd0f041b1 100644 --- a/winpr/libwinpr/sspi/CMakeLists.txt +++ b/winpr/libwinpr/sspi/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/synch/CMakeLists.txt b/winpr/libwinpr/synch/CMakeLists.txt index a4b21ab43..0c584e539 100644 --- a/winpr/libwinpr/synch/CMakeLists.txt +++ b/winpr/libwinpr/synch/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/sysinfo/CMakeLists.txt b/winpr/libwinpr/sysinfo/CMakeLists.txt index f9b7f69bf..799df059e 100644 --- a/winpr/libwinpr/sysinfo/CMakeLists.txt +++ b/winpr/libwinpr/sysinfo/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/thread/CMakeLists.txt b/winpr/libwinpr/thread/CMakeLists.txt index 9897d767a..1b78a74bf 100644 --- a/winpr/libwinpr/thread/CMakeLists.txt +++ b/winpr/libwinpr/thread/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/utils/CMakeLists.txt b/winpr/libwinpr/utils/CMakeLists.txt index 335958d9a..ee5f73bac 100644 --- a/winpr/libwinpr/utils/CMakeLists.txt +++ b/winpr/libwinpr/utils/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/winsock/CMakeLists.txt b/winpr/libwinpr/winsock/CMakeLists.txt index 1d2e1159a..ef13cd1d1 100644 --- a/winpr/libwinpr/winsock/CMakeLists.txt +++ b/winpr/libwinpr/winsock/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(winsock.c) if(WIN32) - winpr_library_add(ws2_32) + winpr_library_add_public(ws2_32) endif()