2021-11-26 02:34:58 +08:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## PROJECT
|
|
|
|
## name and version
|
|
|
|
##
|
|
|
|
project(cachyos-installer
|
2021-12-01 09:31:37 +08:00
|
|
|
VERSION 0.0.1
|
|
|
|
LANGUAGES CXX)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## INCLUDE
|
|
|
|
##
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
include(StandardProjectSettings)
|
|
|
|
include(CompilerWarnings)
|
|
|
|
include(EnableCcache)
|
|
|
|
include(ClangTidy)
|
|
|
|
include(FetchContent)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
FetchContent_Declare(ftxui
|
2021-12-01 09:31:37 +08:00
|
|
|
GIT_REPOSITORY "https://github.com/arthursonzogni/ftxui.git"
|
|
|
|
GIT_TAG "cecd54df42dd66fdf8386ed461e16b725bffc827"
|
|
|
|
)
|
2021-11-26 02:34:58 +08:00
|
|
|
FetchContent_MakeAvailable(ftxui)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
FetchContent_Declare(fmt
|
2021-12-01 09:31:37 +08:00
|
|
|
GIT_REPOSITORY "https://github.com/fmtlib/fmt.git"
|
|
|
|
GIT_TAG "491ba2dda5a04c2438abb6bd90219de773793ec0"
|
|
|
|
)
|
2021-11-26 02:34:58 +08:00
|
|
|
FetchContent_MakeAvailable(fmt)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
FetchContent_Declare(nlohmann_json
|
2021-12-01 09:31:37 +08:00
|
|
|
GIT_REPOSITORY "https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent.git"
|
|
|
|
GIT_TAG "v3.10.4"
|
|
|
|
)
|
2021-11-26 02:34:58 +08:00
|
|
|
FetchContent_MakeAvailable(nlohmann_json)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-30 07:51:27 +08:00
|
|
|
FetchContent_Declare(cpr
|
2021-12-01 09:31:37 +08:00
|
|
|
GIT_REPOSITORY "https://github.com/vnepogodin/cpr.git"
|
|
|
|
GIT_TAG "824358455f61629ca43422adce0243bb05e99bf8"
|
|
|
|
)
|
2021-11-30 07:51:27 +08:00
|
|
|
FetchContent_MakeAvailable(cpr)
|
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## CONFIGURATION
|
|
|
|
##
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-12-01 09:31:37 +08:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fwhole-program")
|
|
|
|
endif ()
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
# Link this 'library' to set the c++ standard / compile-time options requested
|
|
|
|
add_library(project_options INTERFACE)
|
|
|
|
target_compile_features(project_options INTERFACE cxx_std_20)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## Target
|
|
|
|
##
|
|
|
|
add_executable(${PROJECT_NAME}
|
2021-12-01 09:31:37 +08:00
|
|
|
src/definitions.hpp
|
|
|
|
src/config.cpp src/config.hpp
|
|
|
|
src/utils.cpp src/utils.hpp
|
|
|
|
src/tui.cpp src/tui.hpp
|
|
|
|
src/main.cpp
|
|
|
|
)
|
2021-11-26 02:34:58 +08:00
|
|
|
|
|
|
|
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
|
|
|
|
add_library(project_warnings INTERFACE)
|
|
|
|
set_project_warnings(project_warnings)
|
|
|
|
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src)
|
|
|
|
|
2021-11-30 07:51:27 +08:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options fmt::fmt ftxui::screen ftxui::dom ftxui::component nlohmann_json::nlohmann_json cpr::cpr)
|
2021-11-26 02:34:58 +08:00
|
|
|
|
|
|
|
option(ENABLE_UNITY "Enable Unity builds of projects" OFF)
|
2021-12-01 09:31:37 +08:00
|
|
|
if (ENABLE_UNITY)
|
|
|
|
# Add for any project you want to apply unity builds for
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD ON)
|
|
|
|
endif ()
|
2021-11-26 02:34:58 +08:00
|
|
|
|
|
|
|
install(
|
2021-12-01 09:31:37 +08:00
|
|
|
TARGETS ${PROJECT_NAME}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2021-11-26 02:34:58 +08:00
|
|
|
)
|