Skip to content

Commit

Permalink
Use two different find_package() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Jul 10, 2024
1 parent 6d628ef commit 488d265
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,13 @@ if(openPMD_USE_INTERNAL_TOML11)
add_subdirectory("${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/toml11")
message(STATUS "toml11: Using INTERNAL version '3.7.1'")
else()
find_package(toml11 CONFIG REQUIRED)
# Need to check the version manually. toml11 4.0 was a breaking change, so
# find_package(toml11 3.7.1) would not accept versions 4.0+.
# We support both 3.* and 4.*.
if(${toml11_VERSION} VERSION_LESS 3.7.1)
message(FATAL_ERROR "toml11: Found version '${toml11_VERSION}', but requires version '3.7.1' at least.")
else()
message(STATUS "toml11: Found version '${toml11_VERSION}'")
# Since toml11 4.0 was a breaking change,
# it needs separate find_package() calls
find_package(toml11 3.7.0 CONFIG QUIET)
if(NOT toml11_FOUND)
find_package(toml11 4.0 CONFIG REQUIRED)
endif()
message(STATUS "toml11: Found version '${toml11_VERSION}'")
endif()
add_library(openPMD::thirdparty::toml11 INTERFACE IMPORTED)
target_link_libraries(openPMD::thirdparty::toml11
Expand Down

0 comments on commit 488d265

Please sign in to comment.