2022-05-10 20:10:34 +00:00
|
|
|
# Light helpers library expected to be used by all other libraries
|
|
|
|
#
|
|
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
|
|
|
|
project(Helpers
|
|
|
|
VERSION 0.1.0
|
|
|
|
LANGUAGES CXX)
|
|
|
|
|
2022-07-07 18:16:59 +00:00
|
|
|
find_package(nlohmann_json 3.10.5 REQUIRED)
|
|
|
|
|
2022-05-10 20:10:34 +00:00
|
|
|
set(QT_NO_CREATE_VERSIONLESS_FUNCTIONS true)
|
|
|
|
|
|
|
|
find_package(Qt6 ${STATUS_QT_VERSION} COMPONENTS Quick Qml REQUIRED)
|
|
|
|
qt6_standard_project_setup()
|
|
|
|
|
2022-07-04 21:14:13 +00:00
|
|
|
add_library(Helpers SHARED)
|
|
|
|
add_library(Status::Helpers ALIAS Helpers)
|
2022-05-10 20:10:34 +00:00
|
|
|
|
|
|
|
# Setup configuration type (Debug/Release)
|
|
|
|
# Inspired by https://programmingrecluse.wordpress.com/2020/02/04/detect-debug-build-with-cmake/
|
|
|
|
if(CMAKE_CONFIGURATION_TYPES)
|
|
|
|
set(CMAKE_CONFIGURATION_TYPES Debug Release)
|
|
|
|
elseif(NOT CMAKE_BUILD_TYPE)
|
|
|
|
message("Missing Build Type! Run cmake with:\n-DCMAKE_BUILD_TYPE=Debug|Release")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Use by linker only
|
|
|
|
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug)
|
|
|
|
|
|
|
|
# Setup BUILD_DEBUG and BUILD_REALEASE if single configuration builds
|
|
|
|
if(CMAKE_BUILD_TYPE)
|
|
|
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" _upper_build_type)
|
|
|
|
set(BUILD_${_upper_build_type} true)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(BUILD_GENERATED_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
|
|
|
|
|
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/template/BuildConfiguration.h.in"
|
|
|
|
"${BUILD_GENERATED_DIRECTORY}/Helpers/BuildConfiguration.h"
|
|
|
|
@ONLY)
|
|
|
|
|
2022-07-04 21:14:13 +00:00
|
|
|
target_include_directories(Helpers
|
2022-05-10 20:10:34 +00:00
|
|
|
PUBLIC
|
2022-07-04 21:14:13 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
2022-05-10 20:10:34 +00:00
|
|
|
${BUILD_GENERATED_DIRECTORY}
|
|
|
|
|
|
|
|
PRIVATE
|
2022-07-04 21:14:13 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers
|
|
|
|
${BUILD_GENERATED_DIRECTORY}/Helpers
|
2022-05-10 20:10:34 +00:00
|
|
|
)
|
|
|
|
|
2022-07-04 21:14:13 +00:00
|
|
|
target_link_libraries(Helpers
|
2022-07-07 18:16:59 +00:00
|
|
|
PUBLIC
|
|
|
|
nlohmann_json::nlohmann_json
|
|
|
|
|
2022-05-10 20:10:34 +00:00
|
|
|
PRIVATE
|
|
|
|
Qt6::Quick
|
|
|
|
Qt6::Qml
|
|
|
|
)
|
2022-06-07 10:58:06 +00:00
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS
|
2022-07-04 21:14:13 +00:00
|
|
|
Helpers
|
2022-06-07 10:58:06 +00:00
|
|
|
RUNTIME
|
2022-07-04 21:14:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_sources(Helpers
|
|
|
|
PRIVATE
|
2022-07-07 18:16:59 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers/conversions.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers/conversions.cpp
|
2022-07-04 21:14:13 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers/helpers.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers/logs.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers/logs.cpp
|
2022-07-13 16:45:18 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers/NamedType.h
|
2022-07-04 21:14:13 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Helpers/Singleton.h
|
|
|
|
)
|