-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
140 lines (111 loc) · 6.04 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
# Copyright (C) 2007 by Cristóbal Carnero Liñán
#
# This file is part of cvBlob.
#
# cvBlob is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cvBlob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Lesser GNU General Public License for more details.
#
# You should have received a copy of the Lesser GNU General Public License
# along with cvBlob. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 2.0)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
project(cvBlob)
set(CVBLOB_VERSION_MAJOR 0)
set(CVBLOB_VERSION_MINOR 10)
set(CVBLOB_VERSION_PATCH 4)
set(CVBLOB_VERSION "${CVBLOB_VERSION_MAJOR}.${CVBLOB_VERSION_MINOR}.${CVBLOB_VERSION_PATCH}")
set(PACKAGE cvBlob)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)
set(CMAKE_BUILD_TYPE Release)
#set(CMAKE_BUILD_TYPE Debug)
add_subdirectory(cvBlob lib)
#add_subdirectory(pyCvBlob pyCvBlob)
add_subdirectory(test test)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(version ${CVBLOB_VERSION})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvblob.pc.cmake.in" "${CMAKE_BINARY_DIR}/cvblob.pc" @ONLY IMMEDIATE)
# 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" )
# --------------------------------------------------------------------------------------------
# Installation for CMake Module: cvBlobConfig.cmake
# Part 1/3: ${BIN_DIR}/cvBlobConfig.cmake -> For use *without* "make install"
# Part 2/3: ${BIN_DIR}/unix-install/cvBlobConfig.cmake -> For use with "make install"
# Part 3/3: ${BIN_DIR}/win-install/cvBlobConfig.cmake -> For use within binary installers/packages
# -------------------------------------------------------------------------------------------
# -------------------------------------------------------------------------------------------
# Part 1/3: ${BIN_DIR}/cvBlobConfig.cmake -> For use *without* "make install"
# -------------------------------------------------------------------------------------------
# Name of libraries is: libcv.so.1.1.0, etc...
# CVBLOB_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 "${CMAKE_CURRENT_SOURCE_DIR}/include/")
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${LIBRARY_OUTPUT_PATH}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cvBlobConfig.cmake.in" "${CMAKE_BINARY_DIR}/cvBlobConfig.cmake" IMMEDIATE @ONLY)
# --------------------------------------------------------------------------------------------
# Part 2/3: ${BIN_DIR}/unix-install/cvBlobConfig.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/")
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}/cvBlobConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/cvBlobConfig.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/cvBlobConfig.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cvblob/)
endif()
# --------------------------------------------------------------------------------------------
# Part 3/3: ${BIN_DIR}/win-install/cvBlobConfig.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>/cvBlob 1.1.0/include
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "${THIS_CVBLOB_CONFIG_PATH}/include/")
# This will expand to, for example, <program files>/cvBlob 1.1.0/lib
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_CVBLOB_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}/cvBlobConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/cvBlobConfig.cmake" IMMEDIATE @ONLY)
endif()
# --------------------------------------------------------------------------------------------
if(UNIX)
install(FILES "${CMAKE_BINARY_DIR}/cvblob.pc" DESTINATION lib/pkgconfig)
endif(UNIX)
if(WIN32)
set(CPACK_GENERATOR "ZIP")
set(CPACK_SOURCE_GENERATOR "ZIP")
else(WIN32)
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
endif(WIN32)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Blob library for OpenCV")
set(CPACK_PACKAGE_CONTACT [email protected])
set(CPACK_PACKAGE_VENDOR "Cristóbal Carnero Liñán <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION_FILE ${cvBlob_SOURCE_DIR}/README)
set(CPACK_PACKAGE_VERSION_MAJOR ${CVBLOB_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${CVBLOB_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${CVBLOB_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${CVBLOB_VERSION})
set(CPACK_RESOURCE_FILE_LICENSE ${cvBlob_SOURCE_DIR}/COPYING.LESSER)
set(CPACK_RESOURCE_FILE_README ${cvBlob_SOURCE_DIR}/README)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "cvBlob-src-${CPACK_PACKAGE_VERSION}")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
"~$"
"/\\\\.svn/"
# "^${PROJECT_SOURCE_DIR}/old/"
)
include(CPack)