From 51198b555751d061eadf3de6dea9de08d0ec235e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Wed, 17 Jul 2024 12:05:20 +0200 Subject: [PATCH] Some cleanup, fixes and documentation in the find_package() logic --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e1efee0ca..c17631c6cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,11 +278,14 @@ if(openPMD_USE_INTERNAL_TOML11) add_subdirectory("${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/toml11") message(STATUS "toml11: Using INTERNAL version '3.7.1'") else() - # Since toml11 4.0 was a breaking change, - # it needs separate find_package() calls - find_package(toml11 3.7.0 CONFIG QUIET) + # toml11 4.0 was a breaking change. This is reflected in the library's CMake + # logic: version 4.0 is not accepted by a call to find_package(toml11 3.7). + # Since we support both incompatible versions, we use two find_package() + # calls. Search for version 4 first in order to prefer that + # in (the unlikely) case that both versions are installed. + find_package(toml11 4.0 CONFIG QUIET) if(NOT toml11_FOUND) - find_package(toml11 4.0 CONFIG REQUIRED) + find_package(toml11 3.7.1 CONFIG REQUIRED) endif() message(STATUS "toml11: Found version '${toml11_VERSION}'") endif()