Prepare day01 2025

Change-Id: Id3c46f5f552db5a0ba200dedc1ea4e4434932982
This commit is contained in:
2025-12-08 11:43:38 +01:00
parent 49d82b8f90
commit d106e7541d
5 changed files with 301 additions and 2 deletions

70
cmake/Findutf8cpp.cmake Normal file
View 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}")