Skip to content

Commit

Permalink
Update RapidJSON handling in CMakeLists.txt
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
ptahmose committed Sep 20, 2024
1 parent 7088668 commit 15059e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions Src/CZICmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 15059e4

Please sign in to comment.