-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
518 lines (420 loc) · 19.9 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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# ----------------------------------------------------------------------------
# Root CMake file for vosm
#
# From the off-tree build directory, invoke:
# $ cmake <PATH_TO_vosm_ROOT>
#
#
# - AUG-2011: Revised version <[email protected]>
#
# ----------------------------------------------------------------------------
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
# Add these standard paths to the search paths for FIND_LIBRARY
# to find libraries from these locations first
if(UNIX)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /usr/lib)
endif()
# it _must_ go before PROJECT(vosm) in order to work
if (NOT CMAKE_INSTALL_PREFIX)
if (WIN32)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE INTERNAL "" FORCE)
elseif()
set(CMAKE_INSTALL_PREFIX "/usr" CACHE INTERNAL "" FORCE)
endif()
endif()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_VERBOSE OFF CACHE BOOL "Verbose mode")
if (CMAKE_VERBOSE)
set (CMAKE_VERBOSE_MAKEFILE 1)
endif()
project(vosm)
cmake_minimum_required(VERSION 2.4)
if(MSVC)
set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
endif()
#set(CMAKE_C_COMPILER "/opt/BullseyeCoverage/bin/gcc")
#set(CMAKE_CXX_COMPILER "/opt/BullseyeCoverage/bin/g++")
#set(CMAKE_CXX_COMPILER_INIT "/opt/BullseyeCoverage/bin/gcc")
# --------------------------------------------------------------
# Indicate CMake 2.7 and above that we don't want to mix relative
# and absolute paths in linker lib lists.
# Run "cmake --help-policy CMP0003" for more information.
# --------------------------------------------------------------
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()
# ----------------------------------------------------------------------------
# Current version number:
# ----------------------------------------------------------------------------
set(VOSM_VERSION "0.3.2")
string(REGEX MATCHALL "[0-9]" VOSM_VERSION_PARTS "${VOSM_VERSION}")
list(GET VOSM_VERSION_PARTS 0 VOSM_VERSION_MAJOR)
list(GET VOSM_VERSION_PARTS 1 VOSM_VERSION_MINOR)
list(GET VOSM_VERSION_PARTS 2 VOSM_VERSION_PATCH)
set(VOSM_SOVERSION "${VOSM_VERSION_MAJOR}.${VOSM_VERSION_MINOR}")
if(WIN32)
# Postfix of DLLs:
set(VOSM_DLLVERSION "${VOSM_VERSION_MAJOR}${VOSM_VERSION_MINOR}${VOSM_VERSION_PATCH}")
set(VOSM_DEBUG_POSTFIX d)
else()
# Postfix of so's:
#set(VOSM_DLLVERSION "${VOSM_VERSION_MAJOR}${VOSM_VERSION_MINOR}${VOSM_VERSION_PATCH}")
set(VOSM_DLLVERSION "")
set(VOSM_DEBUG_POSTFIX)
endif()
# ----------------------------------------------------------------------------
# Build static or dynamic libs?
# ----------------------------------------------------------------------------
# Default: dynamic libraries:
SET(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
IF(BUILD_SHARED_LIBS)
SET(VOSM_BUILD_SHARED_LIB 1) # For cvconfig.h, etc.
ELSE(BUILD_SHARED_LIBS)
SET(VOSM_BUILD_SHARED_LIB 0)
ENDIF(BUILD_SHARED_LIBS)
# ----------------------------------------------------------------------------
# Variables for cvconfig.h.cmake
# ----------------------------------------------------------------------------
set(PACKAGE "vosm")
set(PACKAGE_BUGREPORT "[email protected]")
set(PACKAGE_NAME "vosm")
set(PACKAGE_STRING "${PACKAGE} ${VOSM_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE}")
set(PACKAGE_VERSION "${VOSM_VERSION}")
# ----------------------------------------------------------------------------
# Autodetect if we are in a SVN repository
# ----------------------------------------------------------------------------
find_program(SVNVERSION_PATH svnversion)
mark_as_advanced(force SVNVERSION_PATH)
if(SVNVERSION_PATH)
message(STATUS "Extracting svn version, please wait...")
execute_process(COMMAND ${SVNVERSION_PATH} -n ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE SVNVERSION_RESULT)
if(SVNVERSION_RESULT MATCHES "exported")
# This is NOT a svn repository:
set(VOSM_SVNVERSION "")
else()
set(VOSM_SVNVERSION " svn:${SVNVERSION_RESULT}")
endif()
message(STATUS "SVNVERSION: ${VOSM_SVNVERSION}")
else()
# We don't have svnversion:
set(VOSM_SVNVERSION "")
endif()
# ----------------------------------------------------------------------------
# Detect GNU version:
# ----------------------------------------------------------------------------
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CMAKE_VOSM_GCC_VERSION_FULL
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Typical output in CMAKE_VOSM_GCC_VERSION_FULL: "c+//0 (whatever) 4.4.5 (...)"
# Look for the version number
string(REGEX MATCH "[0-9].[0-9].[0-9]" CMAKE_GCC_REGEX_VERSION "${CMAKE_VOSM_GCC_VERSION_FULL}")
# Split the three parts:
string(REGEX MATCHALL "[0-9]" CMAKE_VOSM_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")
list(GET CMAKE_VOSM_GCC_VERSIONS 0 CMAKE_VOSM_GCC_VERSION_MAJOR)
list(GET CMAKE_VOSM_GCC_VERSIONS 1 CMAKE_VOSM_GCC_VERSION_MINOR)
set(CMAKE_VOSM_GCC_VERSION ${CMAKE_VOSM_GCC_VERSION_MAJOR}${CMAKE_VOSM_GCC_VERSION_MINOR})
math(EXPR CMAKE_VOSM_GCC_VERSION_NUM "${CMAKE_VOSM_GCC_VERSION_MAJOR}*100 + ${CMAKE_VOSM_GCC_VERSION_MINOR}")
message(STATUS "Detected version of GNU GCC: ${CMAKE_VOSM_GCC_VERSION} (${CMAKE_VOSM_GCC_VERSION_NUM})")
if(WIN32)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE CMAKE_VOSM_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_VOSM_GCC_TARGET_MACHINE MATCHES "64")
set(MINGW64 1)
endif()
endif()
endif()
# ----------------------------------------------------------------------------
# CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
# ----------------------------------------------------------------------------
# Build/install (or not) some apps:
# ===================================================
set(BUILD_EXAMPLES ON CACHE BOOL "Build all examples")
set(INSTALL_C_EXAMPLES ON CACHE BOOL "Install C examples")
#set(INSTALL_PYTHON_EXAMPLES OFF CACHE BOOL "Install Python examples")
# Build tests:
# ===================================================
set(BUILD_TESTS ON CACHE BOOL "Build tests")
include(vosmModule.cmake REQUIRED)
if(UNIX)
include(VOSMFindPkgConfig.cmake OPTIONAL)
include(CheckFunctionExists)
include(CheckIncludeFile)
endif()
# allow fine grained control over which libraries not to link, even if
# they are available on the system
# ====================================================================
set(WITH_BOOST_REGEX ON CACHE BOOL "Include BOOST REGEX support")
set(WITH_BOOST_FILESYSTEM ON CACHE BOOL "Include BOOST FILESYSTEM support")
set(WITH_BOOST_SYSTEM ON CACHE BOOL "Include BOOST SYSTEM support")
set(WITH_OPENCV ON CACHE BOOL "Include OPENCV 2.x support")
# ===================================================
# Macros that checks if module have been installed.
# After it adds module to build and define
# constants passed as second arg
# ===================================================
macro(CHECK_MODULE module_name define)
set(${define} 0)
if(PKG_CONFIG_FOUND)
set(ALIAS ALIASOF_${module_name})
set(ALIAS_FOUND ${ALIAS}_FOUND)
set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS)
set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS)
set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES)
PKG_CHECK_MODULES(${ALIAS} ${module_name})
if (${ALIAS_FOUND})
set(${define} 1)
foreach(P "${ALIAS_INCLUDE_DIRS}")
if (${P})
list(APPEND HIGHGUI_INCLUDE_DIRS ${${P}})
endif()
endforeach()
foreach(P "${ALIAS_LIBRARY_DIRS}")
if (${P})
list(APPEND HIGHGUI_LIBRARY_DIRS ${${P}})
endif()
endforeach()
list(APPEND HIGHGUI_LIBRARIES ${${ALIAS_LIBRARIES}})
endif()
endif()
endmacro()
set(VOSM_LINKER_LIBS ${VOSM_LINKER_LIBS} ${OPENCV_LINKER_LIBS} )
if(WITH_BOOST_REGEX)
CHECK_MODULE(libboost-regex HAVE_BOOST_REGEX)
else()
set(HAVE_BOOST_REGEX FALSE)
endif()
if(WITH_BOOST_FILESYSTEM)
CHECK_MODULE(libboost-filesystem HAVE_BOOST_FILESYSTEM)
else()
set(HAVE_BOOST_FILESYSTEM FALSE)
endif()
if(WITH_OPENCV)
find_path(OPENCV_INCLUDE_PATH "cv.h"
PATHS "/usr/include/opencv" "/usr/local/include/opencv"
DOC "The path to OPENCV headers")
if(OPENCV_INCLUDE_PATH)
include_directories(${OPENCV_INCLUDE_PATH})
set(HAVE_OPENCV TRUE)
endif()
CHECK_MODULE(libopencv_calib3d HAVE_OPENCV_CALIB3D)
CHECK_MODULE(libopencv_contrib HAVE_OPENCV_CONTRIB)
CHECK_MODULE(libopencv_core HAVE_OPENCV_CORE)
CHECK_MODULE(libopencv_features2d HAVE_OPENCV_FEATURE2D)
CHECK_MODULE(libopencv_gpu HAVE_OPENCV_GPU)
CHECK_MODULE(libopencv_highgui HAVE_OPENCV_HIGHGUI)
CHECK_MODULE(libopencv_imgproc HAVE_OPENCV_IMGPROC)
CHECK_MODULE(libopencv_legacy HAVE_OPENCV_LEGACY)
CHECK_MODULE(libopencv_ml HAVE_OPENCV_ML)
CHECK_MODULE(libopencv_objdetect HAVE_OPENCV_OBJDETECT)
CHECK_MODULE(libopencv_video HAVE_OPENCV_VIDEO)
else()
set(HAVE_OPENCV FALSE)
endif()
# ----------------------------------------------------------------------------
# UPDATE CONFIG FILES & SCRIPTS:
#
# CONFIGURE_FILE(InputFile OutputFile [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
# If @ONLY is specified, only variables of the form @VAR@ will be
# replaces and ${VAR} will be ignored.
#
# A directory will be created for each platform so the "cvconfig.h" file is
# not overwritten if cmake generates code in the same path.
# ----------------------------------------------------------------------------
add_definitions(-DHAVE_CONFIG_H)
set(VOSM_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
message(STATUS "Parsing 'cvconfig.h.cmake'")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvconfig.h.cmake" "${VOSM_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
# ---------------------------------------------------------------------------
# The C+//0 include & link directories:
# ---------------------------------------------------------------------------
include_directories("."
"${OPENCV_INCLUDE_PATH}"
"${VOSM_CONFIG_FILE_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/include/opencv"
)
# ----------------------------------------------------------------------------
# Set the maximum level of warnings:
# ----------------------------------------------------------------------------
# Should be set to true for development
set(VOSM_WARNINGS_ARE_ERRORS OFF CACHE BOOL "Treat warnings as errors")
set(EXTRA_C_FLAGS "")
set(EXTRA_C_FLAGS_RELEASE "")
set(EXTRA_C_FLAGS_DEBUG "")
set(EXTRA_EXE_LINKER_FLAGS "")
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "")
set(EXTRA_EXE_LINKER_FLAGS_DEBUG "")
if(MSVC)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
# 64-bit portability warnings, in MSVC8
if(MSVC80)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Wp64")
endif()
#if(MSVC90)
# set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _BIND_TO_CURRENT_CRT_VERSION=1 /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
#endif()
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
#if(ENABLE_OPENMP)
# set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /openmp")
#endif()
# Remove unreferenced functions: function level linking
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Gy")
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Zi")
endif()
# ----------------------------------------------------------------------------
# PROCESS SUBDIRECTORIES:
# ----------------------------------------------------------------------------
# Save libs and executables in the same place
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
if(WIN32)
set(VOSM_DOC_INSTALL_PATH doc)
else()
set(VOSM_DOC_INSTALL_PATH share/vosm/doc)
endif()
# --------------------------------------------------------------------------------------------
# Installation for CMake Module: vosmConfig.cmake
# Part 1/3: ${BIN_DIR}/vosmConfig.cmake -> For use *without* "make install"
# Part 2/3: ${BIN_DIR}/unix-install/vosmConfig.cmake -> For use with "make install"
# Part 3/3: ${BIN_DIR}/win-install/vosmConfig.cmake -> For use within binary installers/packages
# -------------------------------------------------------------------------------------------
# -------------------------------------------------------------------------------------------
# Part 1/3: ${BIN_DIR}/vosmConfig.cmake -> For use *without* "make install"
# -------------------------------------------------------------------------------------------
# Name of libraries is: libcv.so.1.1.0, etc...
# VOSM_DLLVERSION must be set to "110", etc..
# Already done above.
# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"${VOSM_CONFIG_FILE_INCLUDE_DIR}\" \"${CMAKE_CURRENT_SOURCE_DIR}/include\" \"${CMAKE_CURRENT_SOURCE_DIR}/include/vosm\"")
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/vosmConfig.cmake.in" "${CMAKE_BINARY_DIR}/vosmConfig.cmake" IMMEDIATE @ONLY)
# --------------------------------------------------------------------------------------------
# Part 2/3: ${BIN_DIR}/unix-install/vosmConfig.cmake -> For use *with* "make install"
# -------------------------------------------------------------------------------------------
# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/include/opencv" "${CMAKE_INSTALL_PREFIX}/include")
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/lib")
#exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/unix-install/\"")
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/unix-install/\"")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/vosmConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/vosmConfig.cmake" IMMEDIATE @ONLY)
if(UNIX)
# For a command "FIND_PACKAGE(FOO)", CMake will look at the directory /usr/share|lib/FOO/FOOConfig.cmake, so:
install(FILES ${CMAKE_BINARY_DIR}/unix-install/vosmConfig.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/vosm/)
endif()
# --------------------------------------------------------------------------------------------
# Part 3/3: ${BIN_DIR}/win-install/vosmConfig.cmake -> For use within binary installers/packages
# -------------------------------------------------------------------------------------------
if(WIN32)
# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
# This will expand to, for example, <program files>/vosm 0.3.2/include
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_VOSM_CONFIG_PATH}/include\" \"\${THIS_VOSM_CONFIG_PATH}/include/vosm\"")
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"${THIS_VOSM_CONFIG_PATH}\"")
# This will expand to, for example, <program files>/vosm 0.3.2/lib
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_VOSM_CONFIG_PATH}/lib\"")
#exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/win-install/\"")
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/vosmConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/vosmConfig.cmake" IMMEDIATE @ONLY)
endif()
# --------------------------------------------------------------------------------------------
# Part 2/2: ${BIN_DIR}/unix-install/vosm.pc -> For use *with* "make install"
# prefix=/usr
# exec_prefix=${prefix}
# libdir=${exec_prefix}/lib
# includedir=${prefix}/include/vosm
# -------------------------------------------------------------------------------------------
set(opencvdir ${OPENCV_INCLUDE_PATH})
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/lib")
set(includedir "\${prefix}/include")
set(VERSION ${VOSM_VERSION})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/vosm.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/vosm.pc" @ONLY IMMEDIATE)
if(UNIX)
install(FILES ${CMAKE_BINARY_DIR}/unix-install/vosm.pc DESTINATION lib/pkgconfig)
endif()
# ----------------------------------------------------------------------------
# Uninstall target, for "make uninstall"
# ----------------------------------------------------------------------------
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/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")
# ----------------------------------------------------------------------------
# CPack target
# ----------------------------------------------------------------------------
set(BUILD_PACKAGE ON CACHE BOOL "Build a installer with the SDK")
message(STATUS "BUILD_PACKAGE FALSE")
if(BUILD_PACKAGE)
message(STATUS "BUILD_PACKAGE TRUE")
configure_file(
Package.cmake.in
${CMAKE_BINARY_DIR}/.cpack/Package.cmake
@ONLY
)
include(${CMAKE_BINARY_DIR}/.cpack/Package.cmake)
set(root_files README)
file(GLOB root_src_files *.in *.cmake CMakeLists.txt)
if (NOT WIN32)
install(FILES ${root_files}
DESTINATION ${VOSM_DOC_INSTALL_PATH}
COMPONENT main)
else()
install(FILES ${root_files}
DESTINATION "."
COMPONENT main)
install(FILES ${root_src_files}
DESTINATION "."
COMPONENT src)
# Add the "win-install/OpenCVConfig.cmake" file to the "main" install component
install(FILES
"${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake"
DESTINATION "."
COMPONENT main
)
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
foreach(m cxcore cv cvaux ml highgui opencv_ffmpeg)
install(FILES ${CMAKE_BINARY_DIR}/bin/Debug/${m}${VOSM_DLLVERSION}d.dll
DESTINATION bin COMPONENT main)
install(FILES ${CMAKE_BINARY_DIR}/lib/Debug/${m}${VOSM_DLLVERSION}d.lib
DESTINATION lib COMPONENT main)
endforeach()
endif()
install(FILES AUTHORS CHANGES COPYRIGHT HOWTOUSE INSTALL README TODO VERSION DESTINATION share/doc/vosm)
install(DIRECTORY doc/ DESTINATION doc COMPONENT src FILES_MATCHING PATTERN "*.tex")
endif()
endif()
#-----------------------------------
# Subdirectories:
#-----------------------------------
add_subdirectory(modules)
if(BUILD_LATEX_DOCS)
include(OpenCVFindLATEX.cmake REQUIRED)
if(PDFLATEX_COMPILER)
message(STATUS "PDF LaTeX found!")
endif()
endif()
#if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
if(BUILD_EXAMPLES)
add_subdirectory(tests)
endif()
#----------------------------------------------------------------------------
# Generate the vosmModule.cmake file for unix
# installation in CMAKE_INSTALL_PREFIX
#----------------------------------------------------------------------------