openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
134 stars 51 forks source link

CMake 3.27.1 generates warning when using FetchContent #1557

Closed titoiride closed 7 months ago

titoiride commented 7 months ago

Hi everyone, I noticed that building a code that uses openPMD on my laptop now generates some cmake warnings.

[cmake] CMake Deprecation Warning at build/_deps/openpmd-src/share/openPMD/thirdParty/json/CMakeLists.txt:1 (cmake_minimum_required):
[cmake]   Compatibility with CMake < 3.5 will be removed from a future version of
[cmake]   CMake.
[cmake] 
[cmake]   Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake]   CMake that the project does not need compatibility with older versions.
[cmake] 
[cmake] 
[cmake] -- Using the single-header code from /Users/davide/Desktop/Workspace/Codes/RadiationSafety/build/_deps/openpmd-src/share/openPMD/thirdParty/json/single_include/
[cmake] -- nlohmann-json: Using INTERNAL version '3.9.1'
[cmake] CMake Deprecation Warning at build/_deps/openpmd-src/share/openPMD/thirdParty/toml11/CMakeLists.txt:1 (cmake_minimum_required):
[cmake]   Compatibility with CMake < 3.5 will be removed from a future version of
[cmake]   CMake.
[cmake] 
[cmake]   Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake]   CMake that the project does not need compatibility with older versions.
[cmake] 
[cmake] 
[cmake] -- toml11: Using INTERNAL version '3.7.1'
[cmake] CMake Deprecation Warning at build/_deps/openpmd-src/share/openPMD/cmake/FindADIOS.cmake:91 (cmake_minimum_required):
[cmake]   Compatibility with CMake < 3.5 will be removed from a future version of
[cmake]   CMake.
[cmake] 
[cmake]   Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake]   CMake that the project does not need compatibility with older versions.
[cmake] Call Stack (most recent call first):
[cmake]   build/_deps/openpmd-src/CMakeLists.txt:378 (find_package)

To me they look like problems with the openPMD dependencies. I only see this on my personal laptop (MacOS with cmake 3.27.1) and not on NERSC Perlmutter with cmake 3.22.0.

Performed steps The way I link openPMD to my project is using FetchContent, following the documentation

include(FetchContent)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) 
set(openPMD_BUILD_CLI_TOOLS OFF) 
set(openPMD_BUILD_EXAMPLES OFF) 
set(openPMD_BUILD_TESTING OFF) 
set(openPMD_USE_MPI OFF) 
set(openPMD_BUILD_SHARED_LIBS OFF)# precedence over BUILD_SHARED_LIBS if needed
set(openPMD_INSTALL OFF) 
set(openPMD_USE_PYTHON OFF) 
set(openPMD_USE_ADIOS2 OFF) 
set(openPMD_USE_HDF5 ON) 

FetchContent_Declare(
            openPMD
            GIT_REPOSITORY "https://github.com/openPMD/openPMD-api.git"
            GIT_TAG "0.15.1")
FetchContent_MakeAvailable(openPMD)

I was wondering if you're aware of some flags/policies I could set to avoid the warning or if it's something that needs to be changed in the openPMD dependecies.

System environment