uwac: generate .pc and cmake find-module

This commit is contained in:
Bernhard Miklautz 2016-02-25 23:47:32 +01:00
parent 167907ef2e
commit d5a43ddc6e
4 changed files with 95 additions and 0 deletions

View File

@ -25,3 +25,28 @@ set(UWAC_API_VERSION "${UWAC_VERSION_MAJOR}")
add_subdirectory(include)
add_subdirectory(libuwac)
set(UWAC_INCLUDE_DIR "include/uwac${UWAC_VERSION_MAJOR}")
# cmake package
if(${CMAKE_VERSION} VERSION_GREATER "2.8.10")
export(PACKAGE uwac)
set(UWAC_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/uwac${UWAC_VERSION_MAJOR}")
configure_package_config_file(uwacConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake
INSTALL_DESTINATION ${UWAC_CMAKE_INSTALL_DIR}
PATH_VARS UWAC_INCLUDE_DIR)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake
VERSION ${UWAC_VERSION} COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake
DESTINATION ${UWAC_CMAKE_INSTALL_DIR})
install(EXPORT uwac DESTINATION ${UWAC_CMAKE_INSTALL_DIR})
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

15
uwac/uwac.pc.in Normal file
View File

@ -0,0 +1,15 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=${prefix}/@UWAC_INCLUDE_DIR@
libs=-luwac
Name: uwac
Description: uwac: using wayland as a client
URL: http://www.freerdp.com/
Version: @UWAC_VERSION@
Requires:
Requires.private: wayland-client xkbcommon freerdp@FREERDP_VERSION_MAJOR@
Libs: -L${libdir} ${libs}
Libs.private:
Cflags: -I${includedir}

9
uwac/uwacConfig.cmake.in Normal file
View File

@ -0,0 +1,9 @@
@PACKAGE_INIT@
set(UWAC_VERSION_MAJOR "@UWAC_VERSION_MAJOR@")
set(UWAC_VERSION_MINOR "@UWAC_VERSION_MINOR@")
set(UWAC_VERSION_REVISION "@UWAC_VERSION_REVISION@")
set_and_check(UWAC_INCLUDE_DIR "@PACKAGE_UWAC_INCLUDE_DIR@")
include("${CMAKE_CURRENT_LIST_DIR}/uwac.cmake")

46
uwac/uwacVersion.cmake Normal file
View File

@ -0,0 +1,46 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "0.0.1")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("0.0.1" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_MAJOR "0.0.1")
endif()
if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}")
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()