-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
59 lines (46 loc) · 1.26 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
#
# Shared CPP library
#
find_package(fmt CONFIG REQUIRED)
find_package(Threads REQUIRED)
add_library(etcpp STATIC include/etsession.hpp)
target_sources(etcpp PRIVATE
include/etsession.hpp
include/etbackup.hpp
include/etrestore.hpp
include/etlog.hpp
include/etutil.hpp
include/et.hpp
lib/etsession.cpp
lib/etbackup.cpp
lib/etrestore.cpp
lib/etlog.cpp
lib/etutil.cpp
lib/et.cpp
)
if (UNIX)
target_sources(etcpp PRIVATE lib/etutil_unix.cpp)
endif()
if (WIN32)
target_sources(etcpp PRIVATE lib/etutil_win32.cpp)
elseif(APPLE)
target_sources(etcpp PRIVATE lib/etutil_darwin.cpp)
elseif(UNIX)
target_sources(etcpp PRIVATE lib/etutil_linux.cpp)
else()
message(FATAL_ERROR "Unknown platform")
endif()
set(config_file_dir "${CMAKE_CURRENT_BINARY_DIR}/config")
set(config_file "${config_file_dir}/etconfig.hpp")
set(config_file_in "${CMAKE_CURRENT_SOURCE_DIR}/cmake/etconfig.hpp.in")
configure_file("${config_file_in}" "${config_file}" @ONLY)
target_link_libraries(etcpp
PRIVATE etcore
PUBLIC fmt::fmt Threads::Threads
)
if (WIN32)
target_link_libraries(etcpp PUBLIC Userenv)
endif()
target_include_directories(etcpp PUBLIC include ${config_file_dir})
apply_cpp_flags(etcpp)
add_subdirectory(tests)