-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
63 lines (51 loc) · 1.84 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
cmake_minimum_required(VERSION 3.20)
project(VoltCLI VERSION 0.1.0 LANGUAGES CXX)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "^(Linux|Windows)$")
message(FATAL_ERROR "Unknown OS: ${CMAKE_SYSTEM_NAME}")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "64")
set(VOLT_CLI_ARCH "AMD64")
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "86")
set(VOLT_CLI_ARCH "I686")
else()
message(FATAL_ERROR "Unknown CPU architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
set(VOLT_CLI_TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_NAME}${VOLT_CLI_ARCH})
unset(VOLT_CLI_ARCH)
add_compile_definitions(VOLT_CLI_TOOLCHAIN_PREFIX="${VOLT_CLI_TOOLCHAIN_PREFIX}")
message("Volt CLI toolchain prefix: ${VOLT_CLI_TOOLCHAIN_PREFIX}")
# Set output directory to "${CMAKE_BINARY_DIR}/bin"
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${CMAKE_BINARY_DIR}/bin")
endforeach()
# Find Conan packages
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
find_package(CURL REQUIRED)
# find_package(date REQUIRED)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/date")
find_package(nlohmann_json REQUIRED)
find_package(termcolor REQUIRED)
file(GLOB_RECURSE TARGET_SOURCES CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.inl"
)
add_executable(VoltCLI ${TARGET_SOURCES})
set_target_properties(VoltCLI PROPERTIES
CXX_STANDARD 20
OUTPUT_NAME "volt"
)
target_include_directories(VoltCLI PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)
target_link_libraries(VoltCLI PRIVATE
CURL::CURL
Date::Date
nlohmann_json::nlohmann_json
termcolor::termcolor
)
target_precompile_headers(VoltCLI PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src/pch.hpp"
)