vcpkg/ports/hdf5/vcpkg-cmake-wrapper.cmake
Alexander Neumann 2ca3476149 [netcdf-c/hdf5] improve/correct linkage (#6771)
* [netcdf_c] improve HDF5 linkage

* [hdf5] add required HDF5 definitions not set by findHDF5

* [netcdf-c] Call chain HDF5: -> vcpkg_cmake_wrapper (old behvior)
 -> port supplied FindHDF5 -> includes hdf5Config from HDF5_ROOT

* [hdf5] fix szip linkage...again..
will now double link against szip target but thats better than before
the double link issue does not hurt and should be resolved upstream

* revert find_dependency

requires include(CMakeFindDependencyMacro)

* [netcdf-c] removed unnecessary patch
2019-06-08 14:08:59 -07:00

18 lines
736 B
CMake

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.3)
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
if(NOT "CONFIG" IN_LIST ARGS AND NOT "NO_MODULE" IN_LIST ARGS AND "HDF5" IN_LIST ARGS)
# The caller hasn't said "CONFIG", so they want the built-in FindHDF5.cmake behavior. Set configurations macros to ensure the built-in script finds us.
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
set(HDF5_USE_STATIC_LIBRARIES ON)
add_compile_definitions(H5_BUILT_AS_STATIC_LIB)
else()
set(HDF5_USE_STATIC_LIBRARIES OFF)
add_compile_definitions(H5_BUILT_AS_DYNAMIC_LIB)
endif()
endif()
cmake_policy(POP)
endif()
_find_package(${ARGS})