[build] fix install with BUILD_SHARED_LIBS=OFF

generate proper CMake targets so static linking works again.
This commit is contained in:
akallabeth 2023-05-11 14:15:53 +02:00 committed by akallabeth
parent 4e24b966c8
commit 2b3c8c47a4
10 changed files with 36 additions and 22 deletions

View File

@ -162,6 +162,20 @@ macro(add_channel_client_subsystem _channel_prefix _channel_name _subsystem _typ
endif()
endmacro(add_channel_client_subsystem)
macro(channel_install _targets _destination _export_target)
if (NOT BUILD_SHARED_LIBS)
install(TARGETS ${_targets} DESTINATION ${_destination} EXPORT ${_export_target})
endif()
endmacro(channel_install)
macro(server_channel_install _targets _destination)
channel_install(${_targets} ${_destination} "FreeRDP-ServerTargets")
endmacro(server_channel_install)
macro(client_channel_install _targets _destination)
channel_install(${_targets} ${_destination} "FreeRDP-ClientTargets")
endmacro(client_channel_install)
macro(add_channel_client_library _module_prefix _module_name _channel_name _dynamic _entry)
set(_lnk_dir ${${_module_prefix}_LINK_DIRS})
if (NOT "${_lnk_dir}" STREQUAL "")
@ -179,6 +193,7 @@ macro(add_channel_client_library _module_prefix _module_name _channel_name _dyna
if (${_module_prefix}_LIBS)
target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS})
endif()
client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH})
endmacro(add_channel_client_library)
macro(add_channel_client_subsystem_library _module_prefix _module_name _channel_name _type _dynamic _entry)
@ -197,6 +212,7 @@ macro(add_channel_client_subsystem_library _module_prefix _module_name _channel_
if (${_module_prefix}_LIBS)
target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS})
endif()
client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH})
endmacro(add_channel_client_subsystem_library)
macro(add_channel_server_library _module_prefix _module_name _channel_name _dynamic _entry)
@ -216,6 +232,7 @@ macro(add_channel_server_library _module_prefix _module_name _channel_name _dyna
if (${_module_prefix}_LIBS)
target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS})
endif()
server_channel_install(${_module_name} ${FREERDP_ADDIN_PATH})
endmacro(add_channel_server_library)
set(FILENAME "ChannelOptions.cmake")

View File

@ -20,10 +20,13 @@ define_channel_client("rdpsnd")
set(${MODULE_PREFIX}_SRCS
rdpsnd_main.c
rdpsnd_main.h
$<TARGET_OBJECTS:rdpsnd-common>
)
set(${MODULE_PREFIX}_LIBS
winpr freerdp ${CMAKE_THREAD_LIBS_INIT} rdpsnd-common
winpr
freerdp
${CMAKE_THREAD_LIBS_INIT}
)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx;DVCPluginEntry")

View File

@ -21,5 +21,5 @@ set(SRCS
rdpsnd_common.c)
# Library currently header only
add_library(rdpsnd-common STATIC ${SRCS})
add_library(rdpsnd-common OBJECT ${SRCS})

View File

@ -19,10 +19,11 @@ define_channel_server("rdpsnd")
set(${MODULE_PREFIX}_SRCS
rdpsnd_main.c
rdpsnd_main.h)
rdpsnd_main.h
$<TARGET_OBJECTS:rdpsnd-common>
)
set(${MODULE_PREFIX}_LIBS
rdpsnd-common
)
add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry")

View File

@ -26,7 +26,8 @@ set(${MODULE_PREFIX}_SRCS
)
set(${MODULE_PREFIX}_LIBS
winpr freerdp
winpr
freerdp
urbdrc-common
)
if (UDEV_FOUND AND UDEV_LIBRARIES)

View File

@ -107,6 +107,4 @@ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfi
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake
DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR})
if (BUILD_SHARED_LIBS)
install(EXPORT FreeRDP-ClientTargets DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR})
endif()
install(EXPORT FreeRDP-ClientTargets DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR})

View File

@ -90,6 +90,4 @@ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfi
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake
DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})
if (BUILD_SHARED_LIBS)
install(EXPORT FreeRDP-ServerTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})
endif()
install(EXPORT FreeRDP-ServerTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})

View File

@ -39,6 +39,7 @@ set(${MODULE_PREFIX}_SRCS
pf_modules.c
pf_utils.h
pf_utils.c
$<TARGET_OBJECTS:pf_channels>
)
set(PROXY_APP_SRCS freerdp_proxy.c)
@ -73,7 +74,6 @@ endif()
set(PRIVATE_LIBS
freerdp-client
freerdp-server
pf_channels
)
set(PUBLIC_LIBS
@ -103,9 +103,7 @@ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfig
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfigVersion.cmake
DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR})
if (BUILD_SHARED_LIBS)
install(EXPORT FreeRDP-ProxyTargets DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR})
endif()
install(EXPORT FreeRDP-ProxyTargets DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR})
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/proxy")

View File

@ -14,4 +14,4 @@ if (WITH_PROXY_EMULATE_SMARTCARD)
)
endif()
add_library(${MODULE_NAME} STATIC ${SOURCES})
add_library(${MODULE_NAME} OBJECT ${SOURCES})

View File

@ -377,6 +377,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake
DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})
if (BUILD_SHARED_LIBS)
install(EXPORT FreeRDP-ShadowTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})
endif()
install(EXPORT FreeRDP-ShadowTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})