Prepare day01 2025
Change-Id: Id3c46f5f552db5a0ba200dedc1ea4e4434932982
This commit is contained in:
74
cmake/Findctre.cmake
Normal file
74
cmake/Findctre.cmake
Normal file
@@ -0,0 +1,74 @@
|
||||
if (DEFINED _FINDCTRE_INCLUDED)
|
||||
unset(ctre_FOUND CACHE)
|
||||
unset(ctre_DIR CACHE)
|
||||
unset(ctre_INCLUDE_DIR CACHE)
|
||||
unset(ctre_LIBRARIES CACHE)
|
||||
unset(ctre_VERSION CACHE)
|
||||
return()
|
||||
endif()
|
||||
set(_FINDCTRE_INCLUDED TRUE)
|
||||
|
||||
find_package(ctre QUIET)
|
||||
|
||||
if (NOT ctre_FOUND)
|
||||
message(STATUS "ctre not found. Fetching via FetchContent...")
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if (GIT_EXECUTABLE)
|
||||
set(CTRE_FETCH_METHOD "GIT")
|
||||
else()
|
||||
set(CTRE_FETCH_METHOD "ZIP")
|
||||
endif()
|
||||
|
||||
if (CTRE_FETCH_METHOD STREQUAL "GIT")
|
||||
FetchContent_Declare(
|
||||
ctre
|
||||
GIT_REPOSITORY https://github.com/hanickadot/compile-time-regular-expressions.git
|
||||
GIT_TAG v3.10.0
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
ctre
|
||||
URL https://github.com/hanickadot/compile-time-regular-expressions/archive/refs/tags/v3.10.0.zip
|
||||
)
|
||||
endif()
|
||||
|
||||
# Turn off BUILD_TESTING globally to prevent CTest from being included in CTRE
|
||||
set(BUILD_TESTING OFF CACHE BOOL "Disable testing globally" FORCE)
|
||||
# Set the CTRE_BUILD_TESTS option before including the CTRE library
|
||||
set(CTRE_BUILD_TESTS OFF CACHE BOOL "Build ctre Tests" FORCE)
|
||||
FetchContent_MakeAvailable(ctre)
|
||||
else()
|
||||
message(STATUS "ctre found.")
|
||||
|
||||
# Ensure we have a usable target
|
||||
if (NOT TARGET ctre::ctre)
|
||||
if (TARGET ctre)
|
||||
add_library(ctre::ctre ALIAS ctre)
|
||||
else()
|
||||
message(FATAL_ERROR "ctre was found, but no CMake target 'ctre' or 'ctre::ctre' exists.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Populate the standard variables
|
||||
set(ctre_FOUND TRUE)
|
||||
set(ctre_LIBRARIES ctre::ctre)
|
||||
get_target_property(_ctre_inc ctre::ctre INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(ctre_INCLUDE_DIR "${_ctre_inc}")
|
||||
endif()
|
||||
|
||||
if (NOT TARGET ctre::ctre)
|
||||
if (TARGET ctre)
|
||||
add_library(ctre::ctre ALIAS ctre)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find or fetch ctre; no target ctre or ctre::ctre available")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ctre_FOUND TRUE)
|
||||
set(ctre_LIBRARIES ctre::ctre)
|
||||
set(ctre_VERSION "${ctre_VERSION}") # this comes from the ctre project
|
||||
get_target_property(_ctre_inc ctre::ctre INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(ctre_INCLUDE_DIR "${_ctre_inc}")
|
||||
70
cmake/Findfmt.cmake
Normal file
70
cmake/Findfmt.cmake
Normal file
@@ -0,0 +1,70 @@
|
||||
if (DEFINED _FINDFMT_INCLUDED)
|
||||
unset(fmt_FOUND CACHE)
|
||||
unset(fmt_DIR CACHE)
|
||||
unset(fmt_INCLUDE_DIR CACHE)
|
||||
unset(fmt_LIBRARIES CACHE)
|
||||
unset(fmt_VERSION CACHE)
|
||||
return()
|
||||
endif()
|
||||
set(_FINDFMT_INCLUDED TRUE)
|
||||
|
||||
find_package(fmt QUIET)
|
||||
|
||||
if (NOT fmt_FOUND)
|
||||
message(STATUS "fmt not found. Fetching via FetchContent...")
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if (GIT_EXECUTABLE)
|
||||
set(FMT_FETCH_METHOD "GIT")
|
||||
else()
|
||||
set(FMT_FETCH_METHOD "ZIP")
|
||||
endif()
|
||||
|
||||
if (FMT_FETCH_METHOD STREQUAL "GIT")
|
||||
FetchContent_Declare(
|
||||
fmt
|
||||
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
|
||||
GIT_TAG 12.0.0
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
fmt
|
||||
URL https://github.com/fmtlib/fmt/releases/download/12.0.0/fmt-12.0.0.zip
|
||||
)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(fmt)
|
||||
else()
|
||||
message(STATUS "fmt found.")
|
||||
|
||||
# Ensure we have a usable target
|
||||
if (NOT TARGET fmt::fmt)
|
||||
if (TARGET fmt)
|
||||
add_library(fmt::fmt ALIAS fmt)
|
||||
else()
|
||||
message(FATAL_ERROR "fmt was found, but no CMake target 'fmt' or 'fmt::fmt' exists.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Populate the standard variables
|
||||
set(fmt_FOUND TRUE)
|
||||
set(fmt_LIBRARIES fmt::fmt)
|
||||
get_target_property(_fmt_inc fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(fmt_INCLUDE_DIR "${_fmt_inc}")
|
||||
endif()
|
||||
|
||||
if (NOT TARGET fmt::fmt)
|
||||
if (TARGET fmt)
|
||||
add_library(fmt::fmt ALIAS fmt)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find or fetch fmt; no target fmt or fmt::fmt available")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(fmt_FOUND TRUE)
|
||||
set(fmt_LIBRARIES fmt::fmt)
|
||||
set(fmt_VERSION "${fmt_VERSION}") # this comes from the fmt project
|
||||
get_target_property(_fmt_inc fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(fmt_INCLUDE_DIR "${_fmt_inc}")
|
||||
70
cmake/Findutf8cpp.cmake
Normal file
70
cmake/Findutf8cpp.cmake
Normal file
@@ -0,0 +1,70 @@
|
||||
if (DEFINED _FINDUTF8CPP_INCLUDED)
|
||||
unset(utf8cpp_FOUND CACHE)
|
||||
unset(utf8cpp_DIR CACHE)
|
||||
unset(utf8cpp_INCLUDE_DIR CACHE)
|
||||
unset(utf8cpp_LIBRARIES CACHE)
|
||||
unset(utf8cpp_VERSION CACHE)
|
||||
return()
|
||||
endif()
|
||||
set(_FINDUTF8CPP_INCLUDED TRUE)
|
||||
|
||||
find_package(utf8cpp QUIET)
|
||||
|
||||
if (NOT utf8cpp_FOUND)
|
||||
message(STATUS "utf8cpp not found. Fetching via FetchContent...")
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if (GIT_EXECUTABLE)
|
||||
set(UTF8CPP_FETCH_METHOD "GIT")
|
||||
else()
|
||||
set(UTF8CPP_FETCH_METHOD "ZIP")
|
||||
endif()
|
||||
|
||||
if (UTF8CPP_FETCH_METHOD STREQUAL "GIT")
|
||||
FetchContent_Declare(
|
||||
utf8cpp
|
||||
GIT_REPOSITORY https://github.com/nemtrif/utfcpp.git
|
||||
GIT_TAG v4.0.6
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
utf8cpp
|
||||
URL https://github.com/nemtrif/utfcpp/archive/refs/tags/v4.0.6.zip
|
||||
)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(utf8cpp)
|
||||
else()
|
||||
message(STATUS "utf8cpp found.")
|
||||
|
||||
# Ensure we have a usable target
|
||||
if (NOT TARGET utf8cpp::utf8cpp)
|
||||
if (TARGET utf8cpp)
|
||||
add_library(utf8cpp::utf8cpp ALIAS utf8cpp)
|
||||
else()
|
||||
message(FATAL_ERROR "utf8cpp was found, but no CMake target 'utf8cpp' or 'utf8cpp::utf8cpp' exists.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Populate the standard variables
|
||||
set(utf8cpp_FOUND TRUE)
|
||||
set(utf8cpp_LIBRARIES utf8cpp::utf8cpp)
|
||||
get_target_property(_utf8cpp_inc utf8cpp::utf8cpp INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(utf8cpp_INCLUDE_DIR "${_utf8cpp_inc}")
|
||||
endif()
|
||||
|
||||
if (NOT TARGET utf8cpp::utf8cpp)
|
||||
if (TARGET utf8cpp)
|
||||
add_library(utf8cpp::utf8cpp ALIAS utf8cpp)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find or fetch utf8cpp; no target utf8cpp or utf8cpp::utf8cpp available")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(utf8cpp_FOUND TRUE)
|
||||
set(utf8cpp_LIBRARIES utf8cpp::utf8cpp)
|
||||
set(utf8cpp_VERSION "${utf8cpp_VERSION}") # this comes from the utf8cpp project
|
||||
get_target_property(_utf8cpp_inc utf8cpp::utf8cpp INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(utf8cpp_INCLUDE_DIR "${_utf8cpp_inc}")
|
||||
Reference in New Issue
Block a user