aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>2020-11-11 01:37:13 +0800
committerGitHub <noreply@github.com>2020-11-10 09:37:13 -0800
commit202ada4fcf552cd845fa4fd84778281c01b30199 (patch)
treefa497250d5556a61f8ff955f0868457a9d8b1427
parentb24be705e939934a49dcb768850fbf6c1e31ff97 (diff)
downloadvcpkg-202ada4fcf552cd845fa4fd84778281c01b30199.tar.gz
vcpkg-202ada4fcf552cd845fa4fd84778281c01b30199.zip
[netcdf-cxx4] Export cmake targets (#14405)
* [netcdf-cxx4] Update to latest commit and also export targets file * Revert the update to latest commit and make a patch to export cmake targets * Revert the changes in fix-dependecy-hdf5.patch
-rw-r--r--ports/netcdf-cxx4/CONTROL2
-rw-r--r--ports/netcdf-cxx4/export-cmake-targets.patch49
-rw-r--r--ports/netcdf-cxx4/netCDFCxxConfig.cmake.in29
-rw-r--r--ports/netcdf-cxx4/portfile.cmake9
4 files changed, 86 insertions, 3 deletions
diff --git a/ports/netcdf-cxx4/CONTROL b/ports/netcdf-cxx4/CONTROL
index b628a3825..cf6986561 100644
--- a/ports/netcdf-cxx4/CONTROL
+++ b/ports/netcdf-cxx4/CONTROL
@@ -1,6 +1,6 @@
Source: netcdf-cxx4
Version: 4.3.1
-Port-Version: 1
+Port-Version: 2
Build-Depends: hdf5, netcdf-c
Homepage: https://github.com/Unidata/netcdf-cxx4
Description: a set of machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.
diff --git a/ports/netcdf-cxx4/export-cmake-targets.patch b/ports/netcdf-cxx4/export-cmake-targets.patch
new file mode 100644
index 000000000..b46ef3947
--- /dev/null
+++ b/ports/netcdf-cxx4/export-cmake-targets.patch
@@ -0,0 +1,49 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f06fcc0..a19ab28 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -622,9 +622,23 @@ write_basic_package_version_file(
+ VERSION ${NCXX_VERSION}
+ COMPATIBILITY SameMajorVersion
+ )
++
++install(
++ EXPORT netcdf-cxx4Targets
++ FILE netcdf-cxx4Targets.cmake
++ NAMESPACE netCDF::
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/netCDFCxx
++ )
+
++configure_package_config_file(
++ "${CMAKE_CURRENT_SOURCE_DIR}/netCDFCxxConfig.cmake.in"
++ "${CMAKE_CURRENT_BINARY_DIR}/netCDFCxxConfig.cmake"
++ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/netCDFCxx"
++ )
++
+ install(
+ FILES
++ "${CMAKE_CURRENT_BINARY_DIR}/netCDFCxxConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/netCDF/netCDFCxxConfigVersion.cmake"
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/netCDFCxx
+ COMPONENT headers
+diff --git a/cxx4/CMakeLists.txt b/cxx4/CMakeLists.txt
+index b433786..5ef4bed 100644
+--- a/cxx4/CMakeLists.txt
++++ b/cxx4/CMakeLists.txt
+@@ -32,7 +32,7 @@ SET(ALL_TLL_LIBS ${ALL_TLL_LIBS} ${HDF5_C_LIBRARY_hdf5})
+ SET(ALL_TLL_LIBS ${ALL_TLL_LIBS} ${EXTRA_DEPS} PARENT_SCOPE)
+
+ ADD_LIBRARY(netcdf-cxx4 ${CXX_SOURCES})
+-TARGET_INCLUDE_DIRECTORIES(netcdf-cxx4 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
++TARGET_INCLUDE_DIRECTORIES(netcdf-cxx4 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include>)
+ TARGET_LINK_LIBRARIES(netcdf-cxx4 ${ALL_TLL_LIBS})
+ SET_TARGET_PROPERTIES(netcdf-cxx4 PROPERTIES
+ VERSION ${NCXX_LIB_VERSION}
+@@ -49,6 +49,7 @@ INSTALL(
+ )
+ INSTALL(
+ TARGETS netcdf-cxx4
++ EXPORT netcdf-cxx4Targets
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
diff --git a/ports/netcdf-cxx4/netCDFCxxConfig.cmake.in b/ports/netcdf-cxx4/netCDFCxxConfig.cmake.in
new file mode 100644
index 000000000..430d3d911
--- /dev/null
+++ b/ports/netcdf-cxx4/netCDFCxxConfig.cmake.in
@@ -0,0 +1,29 @@
+# NetCDF CXX Configuration Summary
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+if (@netCDF_FOUND@)
+ if(EXISTS "@netCDF_ROOT@")
+ set(netCDF_ROOT "@netCDF_ROOT@")
+ endif()
+ if(EXISTS "@netCDF_DIR@")
+ set(netCDF_DIR "@netCDF_DIR@")
+ endif()
+ find_dependency(netCDF)
+ set(NETCDF_C_LIBRARY ${netCDF_LIBRARIES})
+ set(NETCDF_C_INCLUDE_DIR ${netCDF_INCLUDE_DIR})
+else()
+ set(NETCDF_C_LIBRARY "@NETCDF_C_LIBRARY@")
+ set(NETCDF_C_INCLUDE_DIR "@NETCDF_C_INCLUDE_DIR@")
+endif()
+
+if (NOT TARGET netCDF::netcdf)
+ add_library(netCDF::netcdf UNKNOWN IMPORTED)
+ set_target_properties(netCDF::netcdf PROPERTIES
+ IMPORTED_LOCATION "${NETCDF_C_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_C_INCLUDE_DIR}"
+ )
+endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/netcdf-cxx4Targets.cmake") \ No newline at end of file
diff --git a/ports/netcdf-cxx4/portfile.cmake b/ports/netcdf-cxx4/portfile.cmake
index 3efd8e3aa..f01412804 100644
--- a/ports/netcdf-cxx4/portfile.cmake
+++ b/ports/netcdf-cxx4/portfile.cmake
@@ -8,12 +8,17 @@ vcpkg_from_github(
REF f8882188267488ef801691e69ad072e3eb217ad8 # v4.3.1
SHA512 9816acf221d196e21af19d4c3d85484934916e7c018e9b2c96aab9f5660b2f08c5db9cd8254ba3fa5f0aa5f5c5ad7bd3a3aaba559e5e640c5349d44e07a20ed3
HEAD_REF master
- PATCHES fix-dependecy-hdf5.patch
+ PATCHES
+ fix-dependecy-hdf5.patch
+ export-cmake-targets.patch
)
+#Provided by upstream https://github.com/Unidata/netcdf-cxx4/blob/master/netCDFCxxConfig.cmake.in
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/netCDFCxxConfig.cmake.in DESTINATION ${SOURCE_PATH})
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
- PREFER_NINJA # Disable this option if project cannot be built with Ninja
+ PREFER_NINJA
OPTIONS
-DNCXX_ENABLE_TESTS=OFF
-DCMAKE_INSTALL_CMAKECONFIGDIR=share/netCDFCxx