-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
85 lines (67 loc) · 1.83 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
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
set(CORE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" FORCE)
set(_SOURCE_DIRECTORY "Source")
set(_CORE_FILE_PATH "${CORE_DIRECTORY}/${_SOURCE_DIRECTORY}/Core.h")
include(Modules/Debug)
include(Modules/GetGitCommitHash)
include(Hunter/HunterInit)
project(Core VERSION 0.0.1 LANGUAGES C CXX)
include(ThirdPartyLibraries)
if(NOT (CMAKE_GENERATOR MATCHES "Visual Studio") AND NOT CMAKE_BUILD_TYPE)
message(FATAL_ERROR "Must set 'CMAKE_BUILD_TYPE' for single configuration generators.")
endif()
get_git_commit_hash()
set(CORE_GIT_COMMIT_HASH ${GIT_COMMIT_HASH})
configure_file("${_CORE_FILE_PATH}.in" "${_CORE_FILE_PATH}" @ONLY)
include(SourceFiles)
if(MSVC)
add_compile_options(/Zc:__cplusplus)
endif()
add_library(${PROJECT_NAME} STATIC ${CORE_SOURCE_FILES})
target_include_directories(${PROJECT_NAME}
PUBLIC
${_SOURCE_DIRECTORY}
)
target_compile_definitions(${PROJECT_NAME}
PUBLIC
${PLATFORM_UPPER}
CRYPTOPP_ENABLE_NAMESPACE_WEAK=1
)
if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PUBLIC
NOMINMAX
)
set(CORE_LIBRARIES_WINDOWS
SevenZip::SevenZipCPP
)
endif()
foreach(_BOOST_COMPONENT ${BOOST_COMPONENTS})
list(APPEND BOOST_LIBRARIES Boost::${_BOOST_COMPONENT})
endforeach()
set(CORE_LIBRARIES
${BOOST_LIBRARIES}
BZip2::bz2
cryptopp-static
CURL::libcurl
date::date
date::date-tz
dmc_unrar::dmc_unrar
double-conversion::double-conversion
fmt::fmt
LibLZMA::LibLZMA
Libssh2::libssh2
libzip::zip
magic_enum::magic_enum
RapidJSON::rapidjson
SevenZip::SevenZip
spdlog::spdlog
tidy::tidy-static
tinyxml2::tinyxml2
ZLIB::zlib
zstd::libzstd_static
${CORE_LIBRARIES_${PLATFORM_UPPER}}
)
target_link_libraries(${PROJECT_NAME} PUBLIC ${CORE_LIBRARIES})