This repository has been archived by the owner on Sep 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
145 lines (96 loc) · 4.93 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
#---------------------------------------------------------------------------------------------------------
# cmake required version
#---------------------------------------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.1)
#---------------------------------------------------------------------------------------------------------
# define project
#---------------------------------------------------------------------------------------------------------
project (prep VERSION 0.1.0)
#---------------------------------------------------------------------------------------------------------
# set variables
#---------------------------------------------------------------------------------------------------------
# set path to custom cmake modules
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# use c++17
set(CMAKE_CXX_STANDARD 17)
# library name for this project
set(PROJECT_LIBRARY "utensil")
#---------------------------------------------------------------------------------------------------------
# create the package config for this project
#---------------------------------------------------------------------------------------------------------
include(CreatePackages)
create_packages(DESCRIPTION "a flexible and modular c/c++ dependency manager and build tool")
#---------------------------------------------------------------------------------------------------------
# Setup testing
#---------------------------------------------------------------------------------------------------------
# add options for testing
option(CODE_COVERAGE "Enable code coverage testing." OFF)
option(MEMORY_CHECK "Enable testing for memory leaks." OFF)
enable_testing()
#---------------------------------------------------------------------------------------------------------
# setup and find dependencies
#---------------------------------------------------------------------------------------------------------
if (APPLE)
# osx has its own libarchive but without headers
# set the pkg config path to prefer the homebrew installation
set(ENV{PKG_CONFIG_PATH} "/usr/local/opt/libarchive/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
endif()
find_library(LIB_UTIL util)
find_package(PkgConfig REQUIRED)
# find a libarchive.
pkg_search_module(LibArchive REQUIRED libarchive)
find_library(LIB_UTIL util)
find_library(LIB_FTS fts)
find_program(PACKAGER_PROGRAM dpkg-deb)
if (NOT LIB_FTS)
set(LIB_FTS "")
endif()
# add directories
#---------------------------------------------------------------------------------------------------------
add_subdirectory(plugins)
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(util)
add_subdirectory(man)
#---------------------------------------------------------------------------------------------------------
# add a target to generate API documentation with Doxygen
#---------------------------------------------------------------------------------------------------------
find_package(Doxygen QUIET)
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_LIST_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
else()
message(WARNING "install doxygen to create documentation")
endif()
if (PACKAGER_PROGRAM)
install(DIRECTORY ${CMAKE_BINARY_DIR}/gen/plugins DESTINATION ${CMAKE_INSTALL_PREFIX}/share/prep PATTERN "main" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
#---------------------------------------------------------------------------------------------------------
# install the project cmake module for the current cmake version
#---------------------------------------------------------------------------------------------------------
find_path(CMAKE_PATH cmake)
install(FILES FindPrep.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake-${CMAKE_VERSION}/Modules)
#---------------------------------------------------------------------------------------------------------
# Create DEB
#---------------------------------------------------------------------------------------------------------
# Tell CPack to generate a .deb package
set(CPACK_GENERATOR "DEB")
# Set a Package Maintainer.
# This is required
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Ryan Jennings <ryan@micrantha.com>")
set(CPACK_PACKAGE_VENDOR "Micrantha Software Solutions")
# Set a Package Version
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PKGCONF_DESCRIPTION})
# Override cmake's install prefix, just in case
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
# Include CPack
include(CPack)