diff options
-rw-r--r-- | CMakeLists.txt | 31 | ||||
-rw-r--r-- | cmake/libplistPackaging.cmake | 15 | ||||
-rw-r--r-- | cmake/modules/cmake_uninstall.cmake.in | 21 | ||||
-rw-r--r-- | libplist.pc.in | 14 | ||||
-rw-r--r-- | plutil/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 |
6 files changed, 63 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 201a14e..754c264 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,12 @@ PROJECT( libplist ) +SET( LIBPLIST_VERSION_MAJOR "0" ) +SET( LIBPLIST_VERSION_MINOR "8" ) +SET( LIBPLIST_SOVERSION "0" ) +SET( LIBPLIST_VERSION "${LIBPLIST_VERSION_MAJOR}.${LIBPLIST_VERSION_MINOR}" ) +SET( LIBPLIST_LIBVERSION "${LIBPLIST_SOVERSION}.${LIBPLIST_VERSION}" ) +SET( PLUTIL_VERSION ${LIBPLIST_VERSION} ) + SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/modules ) cmake_minimum_required(VERSION 2.6) @@ -22,19 +29,15 @@ IF ( SWIG_FOUND AND PYTHON_LIBRARY ) ADD_SUBDIRECTORY( swig ) ENDIF ( SWIG_FOUND AND PYTHON_LIBRARY ) -CONFIGURE_FILE( "libplist.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" ) - +# add uninstall target +CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) +ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library to parse and generate Apple's binary and XML PList format") -SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER") -SET(CPACK_PACKAGE_VERSION_MAJOR "0") -SET(CPACK_PACKAGE_VERSION_MINOR "1") -SET(CPACK_PACKAGE_VERSION_PATCH "0") -SET(CPACK_COMPONENT_LIB_DISPLAY_NAME "PList library") -SET(CPACK_COMPONENT_DEV_DISPLAY_NAME "PList development files") -SET(CPACK_COMPONENT_PLUTIL_DISPLAY_NAME "PList conversion tool") -set(CPACK_COMPONENT_DEV_DEPENDS lib) -set(CPACK_COMPONENT_PLUTIL_DEPENDS lib) -INCLUDE(CPack) +########## PkgConfig ############################ +CONFIGURE_FILE( "libplist.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" ) +########## INSTALL ############################## +INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" DESTINATION ${LIBDATA_INSTALL_DIR}/pkgconfig/ ) +########## CPack ################################ +INCLUDE( libplistPackaging ) +LIBPLIST_PACKAGE(LIBPLIST_VERSION_MAJOR LIBPLIST_VERSION_MINOR) diff --git a/cmake/libplistPackaging.cmake b/cmake/libplistPackaging.cmake new file mode 100644 index 0000000..1a5fd92 --- /dev/null +++ b/cmake/libplistPackaging.cmake @@ -0,0 +1,15 @@ +MACRO( LIBPLIST_PACKAGE _major _minor) + + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library to parse and generate Apple's binary and XML PList format") + SET(CPACK_PACKAGE_VERSION_MAJOR ${_major}) + SET(CPACK_PACKAGE_VERSION_MINOR ${_minor}) + SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") + SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER") + SET(CPACK_COMPONENT_LIB_DISPLAY_NAME "PList library") + SET(CPACK_COMPONENT_DEV_DISPLAY_NAME "PList development files") + SET(CPACK_COMPONENT_PLUTIL_DISPLAY_NAME "PList conversion tool") + set(CPACK_COMPONENT_DEV_DEPENDS lib) + set(CPACK_COMPONENT_PLUTIL_DEPENDS lib) + INCLUDE( CPack ) + +ENDMACRO( LIBPLIST_PACKAGE ) diff --git a/cmake/modules/cmake_uninstall.cmake.in b/cmake/modules/cmake_uninstall.cmake.in new file mode 100644 index 0000000..4bfb0bf --- /dev/null +++ b/cmake/modules/cmake_uninstall.cmake.in @@ -0,0 +1,21 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) diff --git a/libplist.pc.in b/libplist.pc.in index 34110e3..c59db5a 100644 --- a/libplist.pc.in +++ b/libplist.pc.in @@ -1,12 +1,12 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ +prefix=${CMAKE_INSTALL_PREFIX} +exec_prefix=${CMAKE_INSTALL_PREFIX} +libdir=${CMAKE_INSTALL_PREFIX}/lib +includedir=${CMAKE_INSTALL_PREFIX}/include Name: libplist Description: A library to handle Apple Property Lists whereas they are binary or XML -Version: @VERSION@ +Version: ${LIBPLIST_VERSION} Requires: libxml-2.0 >= 2.6.30 glib-2.0 >= 2.14.1 -Libs: -L${libdir} -lplist -Cflags: -I${includedir} +Libs: -L${CMAKE_INSTALL_PREFIX}/lib -lplist +Cflags: -I${CMAKE_INSTALL_PREFIX}/include diff --git a/plutil/CMakeLists.txt b/plutil/CMakeLists.txt index fad1cde..149d68f 100644 --- a/plutil/CMakeLists.txt +++ b/plutil/CMakeLists.txt @@ -4,5 +4,6 @@ SET(plutil_SRC ADD_EXECUTABLE(plutil ${plutil_SRC}) TARGET_LINK_LIBRARIES(plutil plist) +SET_TARGET_PROPERTIES( plutil PROPERTIES VERSION ${PLUTIL_VERSION} ) INSTALL( TARGETS plutil RUNTIME DESTINATION bin COMPONENT plutil )
\ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a79c22..4c0f843 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,6 +9,8 @@ SET(libplist_SRC ADD_LIBRARY( plist SHARED ${libplist_SRC} ) TARGET_LINK_LIBRARIES( plist ${LIBXML2_LIBRARIES} ${GLIB2_LIBRARIES} ) +SET_TARGET_PROPERTIES( plist PROPERTIES VERSION ${LIBPLIST_LIBVERSION} ) +SET_TARGET_PROPERTIES( plist PROPERTIES SOVERSION ${LIBPLIST_SOVERSION} ) INSTALL(TARGETS plist RUNTIME DESTINATION bin COMPONENT lib |