polserver/cmake/UTF8.cmake
Fernando Rozenblit 596fb9e0ae
Fix CMake bugs: escript tests under multi-config generators, and cleanups (#895)
- escript tests: pass $<TARGET_FILE:ecompile|runecl> instead of
  ${output_bin_dir}/... - with the Visual Studio generator binaries land
  in bin/<config>/, so every escript_* test failed locally while Ninja CI
  passed
- message(ERROR) is not an error mode; clang-tidy-missing is now FATAL_ERROR
- git_rev target: "BYPRODUCTS=path" was a literal command argument, not the
  BYPRODUCTS keyword; pol_revision.h is now properly declared
- source_group_by_folder: read the computed relative_file variable
  (relative_path was never set, absolute-path sources got an empty group)
- shard_test_2: the second FIXTURES_REQUIRED overwrote the first; merged
  into one property value
- remove dead code: unused DEBUG_VERSION/RELEASE_VERSION defines, unused
  msvc_ide variable, no-op link_directories in set_compile_flags,
  compiler-predefined _WIN32/_WIN64
- guard add_dependencies(lib* lib*_ext) with if(TARGET ...) consistently
  (Antlr/Boost/Efsw/Cppdap already did; the target only exists when the
  prebuilt lib is absent)
- replace deprecated TestBigEndian with CMAKE_CXX_BYTE_ORDER; warn that
  big-endian is unsupported
- restore Boost unknown-toolset FATAL_ERROR (empty toolset made
  bootstrap fail much later with a cryptic error)
- OUTPUT_BINARY_DIR/EXT_DOWNLOAD_DIR are CACHE PATH, not STRING

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 20:58:21 +02:00

39 lines
1.1 KiB
CMake

message("* libutf8cpp")
set(UTF_REPO "https://github.com/nemtrif/utfcpp")
set(UTF_TAG "v4.0.6")
set(UTF_SOURCE_DIR "${EXT_DOWNLOAD_DIR}/utf8-${UTF_TAG}")
set(UTF_INSTALL_DIR "${UTF_SOURCE_DIR}/install")
if (NOT EXISTS "${UTF_INSTALL_DIR}/include/utf8cpp")
ExternalProject_Add(libutf8_ext
GIT_REPOSITORY ${UTF_REPO}
GIT_TAG ${UTF_TAG}
GIT_SHALLOW TRUE
SOURCE_DIR ${UTF_SOURCE_DIR}
PREFIX utf
LIST_SEPARATOR |
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${UTF_INSTALL_DIR}
BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
LOG_OUTPUT_ON_FAILURE 1
EXCLUDE_FROM_ALL 1
)
else()
message(" - already built")
endif()
file(MAKE_DIRECTORY ${UTF_INSTALL_DIR}/include) #directory has to exist during configure
add_library(libutf8 INTERFACE IMPORTED)
set_target_properties(libutf8 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${UTF_INSTALL_DIR}/include"
)
if(TARGET libutf8_ext)
add_dependencies(libutf8 libutf8_ext)
endif()