vcpkg/ports/netcdf-c/portfile.cmake

62 lines
1.7 KiB
CMake
Raw Normal View History

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Unidata/netcdf-c
REF v4.7.0
SHA512 6602799780105c60ac8c873ed4055c1512dc8bebf98de01e1cce572d113ffb3bf3ca522475b93255c415340f672c55dc6785e0bdbcc39055314683da1d02141a
HEAD_REF master
PATCHES
no-install-deps.patch
config-pkg-location.patch
transitive-hdf5.patch
hdf5.patch
hdf5_2.patch
fix-build-error-on-linux.patch
)
#Remove outdated find modules
file(REMOVE "${SOURCE_PATH}/cmake/modules/FindSZIP.cmake")
file(REMOVE "${SOURCE_PATH}/cmake/modules/FindZLIB.cmake")
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(NC_USE_STATIC_CRT ON)
else()
set(NC_USE_STATIC_CRT OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
DISABLE_PARALLEL_CONFIGURE
PREFER_NINJA
OPTIONS
-DBUILD_UTILITIES=OFF
-DBUILD_TESTING=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_TESTS=OFF
-DENABLE_FILTER_TESTING=OFF
-DUSE_HDF5=ON
-DENABLE_DAP_REMOTE_TESTS=OFF
-DDISABLE_INSTALL_DEPENDENCIES=ON
-DNC_USE_STATIC_CRT=${NC_USE_STATIC_CRT}
-DConfigPackageLocation=share/netcdf
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/netcdf)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/bin)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/netcdf-c)
file(
RENAME
${CURRENT_PACKAGES_DIR}/share/netcdf-c/COPYRIGHT
${CURRENT_PACKAGES_DIR}/share/netcdf-c/copyright
)