From 15059e4adfdb33b2009e259e4e9c51e303772243 Mon Sep 17 00:00:00 2001 From: ptahmose Date: Fri, 20 Sep 2024 11:02:06 +0200 Subject: [PATCH] Update RapidJSON handling in CMakeLists.txt Set LIBCZI_BUILD_PREFER_EXTERNALPACKAGE_RAPIDJSON to OFF to ensure automatic download and build of RapidJSON. Added comments to clarify RapidJSON as a header-only library and noted issues with version 1.1.0 on GCC 14.2 with msys2. Using a later version from the master branch (commit 7c73dd7de7c4f14379b781418c6e947ad464c818). --- CMakeLists.txt | 6 +++++- Src/CZICmd/CMakeLists.txt | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc8c3629..bc44979b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,11 @@ check_cxx_symbol_exists(pwrite unistd.h HAVE_UNISTD_H_PWRITE) BoolToFoundNotFound(HAVE_UNISTD_H_PWRITE HAVE_UNISTD_H_PWRITE_TEXT) message("check for open -> ${HAVE_FCNTL_H_OPEN_TEXT} ; check for pread -> ${HAVE_UNISTD_H_PREAD_TEXT} ; check for pwrite -> ${HAVE_UNISTD_H_PWRITE_TEXT}") -# determine whether the Win32-API can be used (in other words: whether we are on a Windows-platform or targetting the Windows-platform) +# Determine whether the Win32-API can be used (in other words: whether we are on a Windows-platform or targetting the Windows-platform). +# Note that just checking for WIN32 is not sufficient here, as this is not defined with environments such as msys2. In those cases, UNIX is defined. +# The meaning of this switch is: whether Win32-API can be used (and this affects not only compilation but e.g. also linking to the Win32-API, as +# it is not automatically linked to when using MinGW or Cygwin). +# TODO(JBL): check how we can make cross-compiling to Windows work if (WIN32 OR CYGWIN OR MSYS OR MINGW) set(LIBCZI_HAVE_WIN32_API ON) else() diff --git a/Src/CZICmd/CMakeLists.txt b/Src/CZICmd/CMakeLists.txt index 60d78089..9d729d44 100644 --- a/Src/CZICmd/CMakeLists.txt +++ b/Src/CZICmd/CMakeLists.txt @@ -39,8 +39,10 @@ if (LIBCZI_BUILD_PREFER_EXTERNALPACKAGE_RAPIDJSON) ]=]) endif() else() - # since "RapidJSON" is a header-only library, we just have to download it and point to the include directory - FetchContent_Declare( + # Since "RapidJSON" is a header-only library, we just have to download it and point to the include directory. + # Note: when using v1.1.0 of RapidJSON (the latest release) there we problems (with GCC14.2 with msys2), so + # we use a later version from the master branch. + FetchContent_Declare( RapidJSON GIT_REPOSITORY https://github.com/Tencent/rapidjson.git GIT_TAG 7c73dd7de7c4f14379b781418c6e947ad464c818 # master as of 2024-08-16