forked from libimobiledevice/libplist
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
83 lines (63 loc) · 2.82 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
PROJECT( libplist )
SET( LIBPLIST_VERSION_MAJOR "1" )
SET( LIBPLIST_VERSION_MINOR "10" )
SET( LIBPLIST_SOVERSION "1" )
SET( LIBPLIST_VERSION "${LIBPLIST_VERSION_MAJOR}.${LIBPLIST_VERSION_MINOR}" )
SET( LIBPLIST_LIBVERSION "${LIBPLIST_SOVERSION}.${LIBPLIST_VERSION}" )
SET( PLISTUTIL_VERSION ${LIBPLIST_VERSION} )
SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/modules )
cmake_minimum_required(VERSION 2.6)
IF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
FIND_PACKAGE( LibXml2 REQUIRED )
OPTION(ENABLE_SWIG "Enable SWIG Python bindings (needs Swig)" ON)
OPTION(ENABLE_CYTHON "Enable Cython Python bindings (needs Cython)" ON)
IF(ENABLE_SWIG)
FIND_PACKAGE( SWIG )
ENDIF(ENABLE_SWIG)
IF(ENABLE_CYTHON)
FIND_PACKAGE( Cython )
ENDIF(ENABLE_CYTHON)
IF(ENABLE_SWIG OR ENABLE_CYTHON)
FIND_PACKAGE( PythonInterp )
FIND_PACKAGE( PythonLibs )
ENDIF(ENABLE_SWIG OR ENABLE_CYTHON)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_INCLUDE_PATH})
ENABLE_TESTING()
IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libcnary/CMakeLists.txt")
MESSAGE(FATAL_ERROR "
You need to checkout the 'libcnary' submodule to build libplist.
To do so, perform the following steps in the base directory:
git submodule init
git submodule update
Then, run cmake again.")
ENDIF()
INCLUDE (TestBigEndian)
TEST_BIG_ENDIAN(endianess)
SET ( PLIST_BYTE_ORDER ${endianess} )
ADD_SUBDIRECTORY( libcnary )
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( plistutil )
ADD_SUBDIRECTORY( include )
ADD_SUBDIRECTORY( test )
ADD_DEPENDENCIES( plist libcnary )
IF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
ADD_SUBDIRECTORY( swig )
ENDIF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
IF ( CYTHON_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
ADD_SUBDIRECTORY( cython )
ENDIF ( CYTHON_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
# 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")
########## PkgConfig ############################
CONFIGURE_FILE( "libplist.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" )
CONFIGURE_FILE( "libplist++.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libplist++.pc" )
########## INSTALL ##############################
INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ )
INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/libplist++.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ )
########## CPack ################################
INCLUDE( libplistPackaging )
LIBPLIST_PACKAGE(LIBPLIST_VERSION_MAJOR LIBPLIST_VERSION_MINOR)