-
Notifications
You must be signed in to change notification settings - Fork 35
/
CMakeLists.txt
63 lines (55 loc) · 1.76 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
# Copyright (C) 2021 by Michael de Gans
#
# 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 <https:#www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.1)
project(cvBlob)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Dependencies
find_package(OpenCV REQUIRED)
set(SRC
cvBlob/cvb_aux.cpp
cvBlob/cvb_blob_list.cpp
cvBlob/cvb_blob.cpp
cvBlob/cvb_contour.cpp
# cvBlob/cvb_track.cpp
)
set(INCLUDES
cvBlob/cvb_aux.h
cvBlob/cvb_blob_list.h
cvBlob/cvb_blob.h
cvBlob/cvb_contour.h
cvBlob/cvb_defines.h
# cvBlob/cvb_track.h
)
# Library target
set(LIB_NAME ${CMAKE_PROJECT_NAME})
add_library(${LIB_NAME} SHARED ${SRC} ${INCLUDES})
target_include_directories(${LIB_NAME} PUBLIC ${OpenCV_INCLUDE_DIRS}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/${LIB_NAME}>
$<INSTALL_INTERFACE:include/${LIB_NAME}> # <prefix>/include/mylib
)
target_link_libraries(${LIB_NAME} ${OpenCV_LIBS})
# Installation
install(TARGETS ${LIB_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
# Somehow, ${CMAKE_INSTALL_INCLUDEDIR} is blank so we use this "custom" path.
install(FILES ${INCLUDES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}
)