-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
89 lines (75 loc) · 2.13 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
#
# Copyright (C) 2022 Dan Arrhenius <dan@ultramarin.se>
#
# This file is part of macgen.
#
# macgen is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required (VERSION 3.15)
# Project name and info
#
project (macgen
VERSION 1.0.6
LANGUAGES CXX
DESCRIPTION "Generate one or more random locally administered MAC addresses."
HOMEPAGE_URL https://github.com/alfmep/macgen
)
# Default GNU installation directories
#
include (GNUInstallDirs)
# Compiler flags
#
if (NOT MSVC)
add_compile_options (-pipe -Wall -O2 -D_GNU_SOURCE)
endif()
# Program name and source files
#
add_executable (macgen
src/appargs.cpp
src/appargs.hpp
src/main.cpp
)
configure_file (src/config.hpp.in src/config.hpp)
if (UNIX)
configure_file (src/macgen.1.in src/macgen.1)
endif()
# Compiler include search path
target_include_directories (macgen PUBLIC
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_BINARY_DIR}/src"
)
# Installation
#
install (TARGETS macgen DESTINATION bin)
#
# Install man page
#
if (UNIX)
install (
FILES "${PROJECT_BINARY_DIR}/src/macgen.1"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_MANDIR}/man1")
endif()
# Uninstall target
#
if (NOT TARGET uninstall)
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target (uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
# Add targets for distributable files
#
include (CPack)