summaryrefslogtreecommitdiff
blob: d5a3467a71bd24e64003ea256b826c9380b1bd10 (plain)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c3879e..a78b993 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
+CMAKE_MINIMUM_REQUIRED (VERSION 2.8.5)
 
 PROJECT (OpenICC)
 
@@ -35,6 +35,16 @@ SET( REVERSE_DOMAIN org.openicc )
 
 SET( ${PROJECT_NAME}_VERSION_MAJORMINOR "${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}" )
 
+include(GNUInstallDirs)
+
+option(ENABLE_TESTS "Build tests (requires static libs)" ON)
+option(ENABLE_TOOLS "Build tools (currently openicc-device)" ON)
+option(ENABLE_STATIC_LIBS "Build static libs" ON)
+
+IF( ENABLE_TESTS )
+  SET(ENABLE_STATIC_LIBS ON)
+ENDIF()
+
 IF( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   SET(PLATFORM "OSX")
 ELSEIF( ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 950d3dc..0a89aea 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -16,13 +16,13 @@ SET (TARGET_CMAKE_FOLDER
 
 SET (TARGET_PLUGIN_FOLDER "openicc"
 		CACHE STRING
-		"Optional folder below system library folder where to install openicc plugins. LIB_SUFFIX is honored."
+		"Optional folder below system library folder where to install openicc plugins."
     )
 
 SET (TARGET_PKGCONFIG_FOLDER
 		"pkgconfig"
 		CACHE STRING
-		"The folder below system library folder where to install pkgconfig files. LIB_SUFFIX is honored."
+		"The folder below system library folder where to install pkgconfig files."
     )
 
 SET (TARGET_DOCUMENTATION_FOLDER
@@ -36,10 +36,6 @@ SET (TARGET_DOCUMENTATION_FOLDER
 # Misc.
 #
 
-SET (LIB_SUFFIX ""
-		CACHE STRING
-		"Optional suffix to use on lib folders (e.g. 64 for lib64)"
-    )
 #cmake settings for use by find_package
 CONFIGURE_FILE (
 		"${CMAKE_CURRENT_SOURCE_DIR}/OpenIccConfig.cmake.in"
@@ -49,6 +45,6 @@ CONFIGURE_FILE (
 
 INSTALL ( FILES
 		"${CMAKE_CURRENT_BINARY_DIR}/OpenIccConfig.cmake"
-		DESTINATION lib${LIB_SUFFIX}/cmake/openicc COMPONENT dev
+		DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/openicc COMPONENT dev
 	)
 
diff --git a/cmake/OpenIccConfig.cmake.in b/cmake/OpenIccConfig.cmake.in
index 46dc1ba..373190f 100644
--- a/cmake/OpenIccConfig.cmake.in
+++ b/cmake/OpenIccConfig.cmake.in
@@ -16,7 +16,7 @@
 # Set path to the header file.
 FIND_PATH(OPENICC_INCLUDE_DIR
 	NAMES openicc_version.h
-	PATHS @CMAKE_INSTALL_PREFIX@/include/@TARGET_INCLUDE_FOLDER@
+	PATHS @CMAKE_INSTALL_FULL_INCLUDEDIR@/@TARGET_INCLUDE_FOLDER@
 	NO_DEFAULT_PATH
 )
 MARK_AS_ADVANCED(OPENICC_INCLUDE_DIR)
@@ -25,7 +25,7 @@ MARK_AS_ADVANCED(OPENICC_INCLUDE_DIR)
 # Set path to the library.
 FIND_LIBRARY(OPENICC_LIBRARY
 	NAMES OpenICC openicc-static
-	PATHS @CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@
+	PATHS @CMAKE_INSTALL_FULL_LIBDIR@
 	NO_DEFAULT_PATH
 )
 MARK_AS_ADVANCED(OPENICC_LIBRARY)
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index a60698a..57cf57f 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -19,5 +19,5 @@ IF( DOXYGEN_FOUND )
   ADD_CUSTOM_TARGET( docu ALL
                      DEPENDS html )
 
-  INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/${PACKAGE_NAME} )
+  INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${CMAKE_INSTALL_DOCDIR} )
 ENDIF()
diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt
index ee939a5..8289b32 100644
--- a/extras/CMakeLists.txt
+++ b/extras/CMakeLists.txt
@@ -13,6 +13,6 @@ CONFIGURE_FILE(
 
 INSTALL( FILES
 		"${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}.pc"
-		DESTINATION lib${LIB_SUFFIX}/${TARGET_PKGCONFIG_FOLDER}
+		DESTINATION ${CMAKE_INSTALL_LIBDIR}/${TARGET_PKGCONFIG_FOLDER}
        )
 
diff --git a/extras/openicc.pc.in b/extras/openicc.pc.in
index 8680344..826a3d0 100644
--- a/extras/openicc.pc.in
+++ b/extras/openicc.pc.in
@@ -1,7 +1,7 @@
 prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}/bin
-libdir=${prefix}/lib@LIB_SUFFIX@
-includedir=${prefix}/include/@TARGET_INCLUDE_FOLDER@
+exec_prefix=${prefix}/@CMAKE_INSTALL_BINDIR@
+libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@TARGET_INCLUDE_FOLDER@
 
 Name: @PACKAGE_NAME@
 Description: @PACKAGE_DESCRIPTION@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 09c6c05..d61f533 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -94,7 +94,7 @@ FIND_PACKAGE( GetText )
 MESSAGE( "GetText: ${GETTEXT_FOUND}" )
 IF( GETTEXT_FOUND )
   SET( USE_GETTEXT TRUE )
-  SET( OI_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale" )
+  SET( OI_LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}" )
 ENDIF()
 
 # debug
@@ -106,9 +106,13 @@ ADD_SUBDIRECTORY( include )
 
 ADD_SUBDIRECTORY( libopenicc )
 
-ADD_SUBDIRECTORY( tests )
+IF( ENABLE_TESTS )
+    ADD_SUBDIRECTORY( tests )
+ENDIF()
 
-ADD_SUBDIRECTORY( tools )
+IF( ENABLE_TOOLS )
+    ADD_SUBDIRECTORY( tools )
+ENDIF()
 
 ADD_SUBDIRECTORY( examples )
 
diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt
index 082eaf8..c37d987 100644
--- a/src/include/CMakeLists.txt
+++ b/src/include/CMakeLists.txt
@@ -16,4 +16,4 @@ SET( CHEADERS_OBJECT_CONFIG_PUBLIC
 INSTALL( FILES
 	${CHEADERS_OBJECT_CONFIG_PUBLIC}
         "${CMAKE_BINARY_DIR}/src/include/openicc_version.h"
-	DESTINATION include/${PROJECT_DOWN_NAME})
+	DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_DOWN_NAME})
diff --git a/src/include/openicc_version.h.in b/src/include/openicc_version.h.in
index 627bd3b..b0b9927 100644
--- a/src/include/openicc_version.h.in
+++ b/src/include/openicc_version.h.in
@@ -8,10 +8,10 @@
 #define OPENICC_VERSION (OPENICC_VERSION_A * 10000 + OPENICC_VERSION_B * 100 + OPENICC_VERSION_C)	/**< version variable */
 
 #define OPENICC_PREFIX         "@CMAKE_INSTALL_PREFIX@"	/**< install variable */
-#define OPENICC_BINDIR         "@CMAKE_INSTALL_PREFIX@/bin"	/**< install variable */
-#define OPENICC_DATADIR        "@CMAKE_INSTALL_PREFIX@/share"	/**< install variable */
-#define OPENICC_LIBDIR         "@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@"	/**< install variable */
-#define OPENICC_DATADIR        "@CMAKE_INSTALL_PREFIX@/share"	/**< install variable */
+#define OPENICC_BINDIR         "@CMAKE_INSTALL_FULL_BINDIR@"	/**< install variable */
+#define OPENICC_DATADIR        "@CMAKE_INSTALL_FULL_DATAROOTDIR@"	/**< install variable */
+#define OPENICC_LIBDIR         "@CMAKE_INSTALL_FULL_LIBDIR@/"	/**< install variable */
+#define OPENICC_DATADIR        "@CMAKE_INSTALL_FULL_DATAROOTDIR@"	/**< install variable */
 #define OPENICC_SYSCOLORDIR    OPENICC_DATADIR "/color"	/**< install variable */
 #define OPENICC_LOCALEDIR      "@OI_LOCALEDIR@"
 #define OPENICC_CMMSUBPATH     "@OI_CMMSUBPATH@"	/**< install variable */
diff --git a/src/libopenicc/CMakeLists.txt b/src/libopenicc/CMakeLists.txt
index 1db9b0e..b4e7994 100644
--- a/src/libopenicc/CMakeLists.txt
+++ b/src/libopenicc/CMakeLists.txt
@@ -36,14 +36,20 @@ ADD_LIBRARY( OpenICC SHARED ${SOURCES} )
 TARGET_LINK_LIBRARIES (
    OpenICC
    ${EXTRA_LIBS} ${EXTRA_LIBS_CS} )
-ADD_LIBRARY( openicc-static STATIC ${SOURCES} )
-TARGET_LINK_LIBRARIES (
-   openicc-static
-   ${EXTRA_LIBS} ${EXTRA_LIBS_CS} )
 
-INSTALL( TARGETS OpenICC openicc-static
-         RUNTIME DESTINATION bin
-         LIBRARY DESTINATION lib${LIB_SUFFIX}
-         ARCHIVE DESTINATION lib${LIB_SUFFIX} )
+INSTALL( TARGETS OpenICC
+         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
 
+IF(ENABLE_STATIC_LIBS)
+   ADD_LIBRARY( openicc-static STATIC ${SOURCES} )
+   TARGET_LINK_LIBRARIES (
+   openicc-static
+   ${EXTRA_LIBS} ${EXTRA_LIBS_CS} )
 
+   INSTALL( TARGETS openicc-static
+            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+            LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+            ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
+ENDIF()
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 8792328..4bb1602 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -1,5 +1,5 @@
 # Device listing
 ADD_EXECUTABLE( openicc-device "${CMAKE_CURRENT_SOURCE_DIR}/openicc_device.c" )
 TARGET_LINK_LIBRARIES( openicc-device OpenICC ${EXTRA_LIBS} )
-INSTALL (TARGETS openicc-device DESTINATION bin)
+INSTALL (TARGETS openicc-device DESTINATION ${CMAKE_INSTALL_BINDIR})