[cmake] fix mingw linking

This commit is contained in:
akallabeth 2024-04-03 09:21:39 +02:00 committed by akallabeth
parent e5799ec947
commit 735cb1ec14
3 changed files with 23 additions and 20 deletions

View File

@ -65,15 +65,16 @@ else()
endif() endif()
target_include_directories(${MODULE_NAME} INTERFACE $<INSTALL_INTERFACE:include>) target_include_directories(${MODULE_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
list(APPEND LIBS freerdp-client) list(APPEND PUB_LIBS freerdp-client)
list(APPEND LIBS winpr freerdp) list(APPEND PUB_LIBS winpr freerdp)
list(APPEND LIBS msimg32.lib credui.lib) list(APPEND PRIV_LIBS msimg32.lib credui.lib)
if (MINGW) if (MINGW)
list(APPEND LIBS ntdll.lib) # only required with MINGW list(APPEND PRIV_LIBS ntdll.lib) # only required with MINGW
endif() endif()
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) target_link_libraries(${MODULE_NAME} PUBLIC ${PUB_LIBS})
target_link_libraries(${MODULE_NAME} PRIVATE ${PRIV_LIBS})
if(WITH_CLIENT_INTERFACE) if(WITH_CLIENT_INTERFACE)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)

View File

@ -91,7 +91,7 @@ else()
endif() endif()
target_include_directories(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>) target_include_directories(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
set(LIBS set(PRIV_LIBS
${X11_LIBRARIES} ${X11_LIBRARIES}
) )
@ -101,7 +101,7 @@ find_package(X11 REQUIRED)
if(X11_XShm_FOUND) if(X11_XShm_FOUND)
add_definitions(-DWITH_XSHM) add_definitions(-DWITH_XSHM)
include_directories(${X11_XShm_INCLUDE_PATH}) include_directories(${X11_XShm_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xext_LIB} ${X11_Xext_LIB}
) )
endif() endif()
@ -113,7 +113,7 @@ if (WITH_XINERAMA)
if(X11_Xinerama_FOUND) if(X11_Xinerama_FOUND)
add_definitions(-DWITH_XINERAMA) add_definitions(-DWITH_XINERAMA)
include_directories(${X11_Xinerama_INCLUDE_PATH}) include_directories(${X11_Xinerama_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xinerama_LIB} ${X11_Xinerama_LIB}
) )
endif() endif()
@ -124,7 +124,7 @@ if (WITH_XEXT)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
if(X11_Xext_FOUND) if(X11_Xext_FOUND)
add_definitions(-DWITH_XEXT) add_definitions(-DWITH_XEXT)
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xext_LIB} ${X11_Xext_LIB}
) )
endif() endif()
@ -136,7 +136,7 @@ if (WITH_XCURSOR)
if(X11_Xcursor_FOUND) if(X11_Xcursor_FOUND)
add_definitions(-DWITH_XCURSOR) add_definitions(-DWITH_XCURSOR)
include_directories(${X11_Xcursor_INCLUDE_PATH}) include_directories(${X11_Xcursor_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xcursor_LIB} ${X11_Xcursor_LIB}
) )
endif() endif()
@ -148,7 +148,7 @@ if (WITH_XV)
if(X11_Xv_FOUND) if(X11_Xv_FOUND)
add_definitions(-DWITH_XV) add_definitions(-DWITH_XV)
include_directories(${X11_Xv_INCLUDE_PATH}) include_directories(${X11_Xv_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xv_LIB} ${X11_Xv_LIB}
) )
endif() endif()
@ -160,7 +160,7 @@ if (WITH_XI)
if(X11_Xi_FOUND) if(X11_Xi_FOUND)
add_definitions(-DWITH_XI) add_definitions(-DWITH_XI)
include_directories(${X11_Xi_INCLUDE_PATH}) include_directories(${X11_Xi_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xi_LIB} ${X11_Xi_LIB}
) )
endif() endif()
@ -172,7 +172,7 @@ if(WITH_XRENDER)
if(X11_Xrender_FOUND) if(X11_Xrender_FOUND)
add_definitions(-DWITH_XRENDER) add_definitions(-DWITH_XRENDER)
include_directories(${X11_Xrender_INCLUDE_PATH}) include_directories(${X11_Xrender_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xrender_LIB} ${X11_Xrender_LIB}
) )
endif() endif()
@ -184,7 +184,7 @@ if (WITH_XRANDR)
if(X11_Xrandr_FOUND) if(X11_Xrandr_FOUND)
add_definitions(-DWITH_XRANDR) add_definitions(-DWITH_XRANDR)
include_directories(${X11_Xrandr_INCLUDE_PATH}) include_directories(${X11_Xrandr_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xrandr_LIB} ${X11_Xrandr_LIB}
) )
endif() endif()
@ -196,7 +196,7 @@ if (WITH_XFIXES)
if(X11_Xfixes_FOUND) if(X11_Xfixes_FOUND)
add_definitions(-DWITH_XFIXES) add_definitions(-DWITH_XFIXES)
include_directories(${X11_Xfixes_INCLUDE_PATH}) include_directories(${X11_Xfixes_INCLUDE_PATH})
list(APPEND LIBS list(APPEND PRIV_LIBS
${X11_Xfixes_LIB} ${X11_Xfixes_LIB}
) )
endif() endif()
@ -204,15 +204,18 @@ endif()
include_directories(${PROJECT_SOURCE_DIR}/resources) include_directories(${PROJECT_SOURCE_DIR}/resources)
list(APPEND LIBS list(APPEND PUB_LIBS
freerdp-client freerdp-client
freerdp )
list(APPEND PRIV_LIBS
m m
) )
if (NOT APPLE) if (NOT APPLE)
list(APPEND LIBS rt) list(APPEND PRIV_LIBS rt)
endif() endif()
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS}) target_link_libraries(${PROJECT_NAME} PUBLIC ${PUB_LIBS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${PRIV_LIBS})
if(WITH_IPP) if(WITH_IPP)
target_link_libraries(${PROJECT_NAME} PRIVATE ${IPP_LIBRARY_LIST}) target_link_libraries(${PROJECT_NAME} PRIVATE ${IPP_LIBRARY_LIST})

View File

@ -27,7 +27,6 @@ set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "..")
list(APPEND LIBS list(APPEND LIBS
xfreerdp-client xfreerdp-client
freerdp-client
) )
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})