update and improve pkg-config files

* generate pkg-config files top level to make sure all
  exports are available (eg. client/server)
* .pc libs section is now generated from export libraries
* update .pc file to use .private fields (prevent overlinking)
This commit is contained in:
Bernhard Miklautz 2014-04-23 13:12:23 +02:00
parent b817e92e5e
commit dee9188191
5 changed files with 32 additions and 23 deletions

View File

@ -612,3 +612,30 @@ endif()
#message("VENDOR: ${VENDOR} CLIENT_VENDOR_PATH: ${CLIENT_VENDOR_PATH} CMAKE_CPACK_INCLUDE_FILE: ${CMAKE_CPACK_INCLUDE_FILE}")
include(${CMAKE_CPACK_INCLUDE_FILE})
if(MONOLITHIC_BUILD)
set(FREERDP_PC_LIBS "-lfreerdp -lfreerdp-client")
set(WINPR_PC_LIBS "-lwinpr")
if (WITH_SERVER)
set(FREERDP_PC_LIBS "${FREERDP_PC_LIBS} -lfreerdp-server")
endif()
else(MONOLITHIC_BUILD)
# freerdp exports
get_property(MEXPORTS GLOBAL PROPERTY "freerdp_EXPORTS")
foreach(EXPORT_MODULE ${MEXPORTS})
list(APPEND FREERDP_PC_LIBS "-lfreerdp-${EXPORT_MODULE}")
endforeach()
string(REPLACE ";" " " FREERDP_PC_LIBS "${FREERDP_PC_LIBS}")
# winpr exports
get_property(MEXPORTS GLOBAL PROPERTY "winpr_EXPORTS")
foreach(EXPORT_MODULE ${MEXPORTS})
list(APPEND WINPR_PC_LIBS "-lwinpr-${EXPORT_MODULE}")
endforeach()
string(REPLACE ";" " " WINPR_PC_LIBS "${WINPR_PC_LIBS}")
endif(MONOLITHIC_BUILD)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -9,5 +9,7 @@ Description: FreeRDP: A Remote Desktop Protocol Implementation
URL: http://www.freerdp.com/
Version: @FREERDP_VERSION_FULL@
Requires:
Requires.private: winpr zlib libssl
Libs: -L${libdir} ${libs}
Libs.private: -ldl -lpthread
Cflags: -I${includedir}

View File

@ -66,10 +66,4 @@ if(MONOLITHIC_BUILD)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT FreeRDPTargets)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")
endif()
message("FREERDP_LIBS: ${FREERDP_LIBS}")
set(FREERDP_PC_LIBS "-lfreerdp -lwinpr")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif(MONOLITHIC_BUILD)

View File

@ -9,5 +9,7 @@ Description: WinPR: Windows Portable Runtime
URL: http://www.freerdp.com/
Version: @WINPR_VERSION_FULL@
Requires:
Requires.private: zlib libssl
Libs: -L${libdir} ${libs}
Libs.private: -ldl -lrt -lm -lpthread
Cflags: -I${includedir}

View File

@ -42,7 +42,6 @@ foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES})
add_subdirectory(${${MODULE_PREFIX}_SUBMODULE})
endforeach()
message("WINPR_LIBS: ${WINPR_LIBS}")
if(MONOLITHIC_BUILD)
foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES})
@ -59,20 +58,5 @@ if(MONOLITHIC_BUILD)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT WinPRTargets)
set(WINPR_PC_LIBS "-lwinpr")
foreach(WINPR_LIB ${WINPR_LIBS})
if(${WINPR_LIB} MATCHES "^-l.*")
set(WINPR_PC_LIBS "${WINPR_PC_LIBS} ${WINPR_LIB}")
elseif(${WINPR_LIB} MATCHES "^/.*")
else()
set(WINPR_PC_LIBS "${WINPR_PC_LIBS} -l${WINPR_LIB}")
endif()
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/libwinpr")
endif()