NetCDF-C ++: как его собрать? - PullRequest
0 голосов
/ 03 октября 2019

Я хотел бы использовать NetCDF API в моих C ++ проектах.

В официальной документации веб-сайта я видел, что этот интерфейс C ++ имеет зависимость компиляции NetCDF-C библиотека.

Я уже скачал двоичный установщик NetCDF-C (называемый netCDF4.7.1-NC4-DAP-64.exe) с официального сайта ( ссылка здесь ), установил его и добавил установленную папку в мойPATH.

C:\Program Files\netCDF 4.7.1\

Итак, я проверил это в консоли Windows: ncdump.exe ... и все работает хорошо!

Теперь я клонировалРепозиторий NetCDF-CXX4 (ссылка здесь) и попытался скомпилировать его, , но я получил много ошибок CMake.

Моя система:

  • Windows 10 x64
  • Visual Studio 2019 Enterprise
  • CMake 3.14.4
  • NetCDF-CXX 4.3.1

Что я сделал

Внутри клонированной папки NetCDF-CXX4 я создал папку под названием «build». Внутри папки build я набрал: cmake ..

Вот ошибка консоли

 cmake ..
-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.23.28105.4
-- The CXX compiler identification is MSVC 19.23.28105.4
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found bash: C:/Program Files/Git/usr/bin/bash.exe
-- Looking for nc_use_parallel_enabled in netcdf
CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5-shared" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5_hl-shared" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5-shared" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5_hl-shared" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5-shared" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5_hl-shared" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5-shared" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5_hl-shared" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5-shared" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_7cc31" links to target "hdf5::hdf5_hl-shared" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at C:/Program Files/cmake/share/cmake-3.14/Modules/CheckLibraryExists.cmake:67 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:382 (CHECK_LIBRARY_EXISTS)


-- Configuring incomplete, errors occurred!
See also "C:/Users/lamar/Desktop/netcdf-cxx4-4.3.1/build/CMakeFiles/CMakeOutput.log".

Что мне нужно сделать для создания статических / динамических библиотек NetCDF-CXX4в моей системе?

...