-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
58 lines (51 loc) · 1.58 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
cmake_minimum_required(VERSION 3.14)
project(wakeup
DESCRIPTION "Wake your computer from sleep by sending a Magic Packet"
LANGUAGES CXX
VERSION 0.0.1)
set(Boost_NO_BOOST_CMAKE On)
set(CMAKE_CXX_EXTENSIONS Off)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED On)
set(CMAKE_POSITION_INDEPENDENT_CODE On)
include(./cmake/CPM.cmake)
set(BOOST_VERSION 1.67.0)
find_package(Boost ${BOOST_VERSION} QUIET)
if (NOT ${Boost_FOUND})
CPMAddPackage(
NAME boost-cmake
GITHUB_REPOSITORY Orphis/boost-cmake
VERSION ${BOOST_VERSION}
)
elseif (NOT TARGET Boost::system)
# Add Boost::system target for Boost packages compiled without CMake
if (NOT TARGET Boost_system)
add_library(Boost_system INTERFACE)
endif ()
add_library(Boost::system ALIAS Boost_system)
endif ()
set(CXXOPTS_VERSION 2.2.0)
find_package(cxxopts ${CXXOPTS_VERSION} QUIET)
if (NOT ${cxxopts_FOUND})
CPMAddPackage(
NAME cxxopts
GITHUB_REPOSITORY jarro2783/cxxopts
VERSION ${CXXOPTS_VERSION}
OPTIONS
"CXXOPTS_BUILD_EXAMPLES Off"
"CXXOPTS_BUILD_TESTS Off"
)
endif ()
set(FMT_VERSION 7.0.1)
find_package(fmt ${FMT_VERSION} QUIET)
if (NOT ${fmt_FOUND})
CPMAddPackage(
NAME fmt
GITHUB_REPOSITORY fmtlib/fmt
GIT_TAG ${FMT_VERSION}
)
endif ()
find_package(Threads REQUIRED)
add_executable(wakeup main.cpp)
target_compile_definitions(wakeup PRIVATE -DPROGRAM_VERSION="${CMAKE_PROJECT_VERSION}")
target_link_libraries(wakeup PRIVATE Boost::boost Boost::system cxxopts fmt Threads::Threads)