-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
138 lines (120 loc) · 4.2 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
OPTION(ENABLE_SHARED_LIBS "Build shared libs" ON)
OPTION(ENABLE_STATIC_LIBS "Build static libs" ON)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12)
PROJECT (libXcm)
OPTION(ENABLE_INSTALL_XCM "Install files" ON)
ELSE()
MESSAGE( "-- libxcm: compile as subproject - skip install (ENABLE_INSTALL_XCM=OFF)" )
# disable install and build of shared libs for fallback subproject
IF(NOT ENABLE_INSTALL_XCM)
SET(ENABLE_INSTALL_XCM OFF)
ENDIF(NOT ENABLE_INSTALL_XCM)
SET(ENABLE_STATIC_LIBS ON)
SET(ENABLE_SHARED_LIBS OFF)
ENDIF()
SET (OPROJECT_NAME "XCM" )
SET( ${OPROJECT_NAME}_PACKAGE_MAJOR 0)
SET( ${OPROJECT_NAME}_PACKAGE_MINOR 5)
SET( ${OPROJECT_NAME}_PACKAGE_MICRO 5)
SET( PACKAGE_VERSION ${${OPROJECT_NAME}_PACKAGE_MAJOR}.${${OPROJECT_NAME}_PACKAGE_MINOR}.${${OPROJECT_NAME}_PACKAGE_MICRO} )
INCLUDE(GNUInstallDirs)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include/X11/Xcm
${CMAKE_BINARY_DIR}/src/include
${CMAKE_BINARY_DIR}/src/include/X11/Xcm/
${CMAKE_CURRENT_SOURCE_DIR}/src
)
# dependencies
INCLUDE(CheckLibraryExists)
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILE(langinfo.h HAVE_LANGINFO_H)
CHECK_INCLUDE_FILE(locale.h HAVE_LOCALE_H)
CHECK_INCLUDE_FILE(libintl.h HAVE_LIBINTL_H)
FIND_LIBRARY( LIBINTL_LIBRARIES NAMES intl libintl libintl-8 )
IF(LIBINTL_LIBRARIES)
SET( EXTRA_LIBS ${EXTRA_LIBS} ${LIBINTL_LIBRARIES} )
SET( EXTRA_LIBS_CORE ${EXTRA_LIBS_CORE} ${LIBINTL_LIBRARIES} )
ELSE(LIBINTL_LIBRARIES)
MESSAGE( "-- libintl not found" )
ENDIF(LIBINTL_LIBRARIES)
CHECK_LIBRARY_EXISTS(m pow "math.h" HAVE_M)
IF(HAVE_M)
FIND_LIBRARY( LIBM_LIBRARIES NAMES m )
IF(LIBM_LIBRARIES)
SET( EXTRA_LIBS ${EXTRA_LIBS} ${LIBM_LIBRARIES} )
ENDIF(LIBM_LIBRARIES)
MESSAGE( "-- m: ${LIBM_LIBRARIES}" )
ELSE(HAVE_M)
MESSAGE( "-- m not found" )
ENDIF(HAVE_M)
CHECK_LIBRARY_EXISTS(c malloc "stdio.h" HAVE_C)
IF(HAVE_C)
FIND_LIBRARY( LIBC_LIBRARIES NAMES c )
IF(LIBC_LIBRARIES)
SET( EXTRA_LIBS ${EXTRA_LIBS} ${LIBC_LIBRARIES} )
ENDIF(LIBC_LIBRARIES)
MESSAGE( "-- c: ${LIBC_LIBRARIES}" )
ELSE(HAVE_C)
MESSAGE( "-- c not found" )
ENDIF(HAVE_C)
FIND_PATH( STDINT_INCLUDE_DIR stdint.h
HINTS /mingw ${INCLUDE_DIRECTORIES}
PATH_SUFFIXES include
)
IF(STDINT_INCLUDE_DIR)
SET( HAVE_STDINT_H 1 )
MESSAGE( "-- stdint.h: " ${STDINT_INCLUDE_DIR} )
ELSE(STDINT_INCLUDE_DIR)
MESSAGE( "-- stdint.h not found" )
ENDIF(STDINT_INCLUDE_DIR)
FIND_PATH( INTTYPES_INCLUDE_DIR inttypes.h
HINTS /mingw ${INCLUDE_DIRECTORIES}
PATH_SUFFIXES include
)
IF(INTTYPES_INCLUDE_DIR)
SET( HAVE_INTTYPES_H 1 )
MESSAGE( "-- inttypes.h: " ${INTTYPES_INCLUDE_DIR} )
ELSE(INTTYPES_INCLUDE_DIR)
MESSAGE( "-- inttypes.h not found" )
ENDIF(INTTYPES_INCLUDE_DIR)
# debug
GET_PROPERTY(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
#MESSAGE( "-- INCLUDE_DIRECTORIES: ${inc_dirs}" )
ADD_SUBDIRECTORY( src )
IF(ENABLE_INSTALL_XCM)
SET( PACKAGE_NAME ${OPROJECT_NAME} )
SET (PROJECT_DOWN_NAME "xcm" )
ADD_SUBDIRECTORY( cmake )
ADD_SUBDIRECTORY( extras )
SET( MAN3_PAGES
doc/man/man3/Xcm.3
doc/man/man3/XcmDDC.3
doc/man/man3/XcmEdidParse.3
doc/man/man3/XcmEvents.3
doc/man/man3/XcolorProfile.3
doc/man/man3/XcolorRegion.3
libXcm.3
)
INSTALL( FILES ${MAN3_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 )
SET( CHEADERS_PUBLIC
include/X11/Xcm/Xcm.h
include/X11/Xcm/XcmDDC.h
include/X11/Xcm/XcmEdidParse.h
include/X11/Xcm/XcmEvents.h
)
INSTALL( FILES
${CHEADERS_PUBLIC}
${CMAKE_BINARY_DIR}/src/include/X11/Xcm/XcmVersion.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/X11/Xcm )
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/XcmUninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/XcmUninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET( uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/XcmUninstall.cmake")
ENDIF(ENABLE_INSTALL_XCM)
SET( SOURCES_STATIC ${SOURCES_STATIC} PARENT_SCOPE )