vcpkg/ports/netcdf-c/portfile.cmake
2019-03-14 22:30:51 +01:00

61 lines
1.9 KiB
CMake

# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/netcdf-c-4.6.2)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/Unidata/netcdf-c/archive/v4.6.2.tar.gz"
FILENAME "netcdf-c-v4.6.2.tar.gz"
SHA512 7c7084e80cf2fb86cd05101f5be7b74797ee96bf49afadfae6ab32ceed6cd9a049bfa90175e7cc0742806bcd2f61156e33fe7930c7b646661d9c89be6b20dea3
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
no-install-deps.patch
config-pkg-location.patch
transitive-hdf5.patch
fix_curl_linkage.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
-DBUILD_UTILITIES=OFF
-DBUILD_TESTING=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_TESTS=OFF
-DUSE_HDF5=ON
-DENABLE_DAP_REMOTE_TESTS=OFF
-DDISABLE_INSTALL_DEPENDENCIES=ON
-DConfigPackageLocation=share/netcdf
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
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
)