vcpkg/ports/jansson/portfile.cmake
Thomas1664 585ff442dd
[jansson] Fix UWP build (#24466)
* [jansson] cleanup

* version

* Roll back version

* version

* Unsupported on UWP

* version

* patch

* Remove supports

* version
2022-04-28 20:50:41 -07:00

41 lines
1.3 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO akheron/jansson
REF 684e18c927e89615c2d501737e90018f4930d6c5 # v2.14
SHA512 e2cac3567bc860d10d9aa386ce370876cb21ff083a970abeb48112b6586b91cd101694a98cb05a06795fb04498e6bc2df3615fedb86635f5a998b68e5670e5b3
HEAD_REF master
PATCHES
fix-linker-flags.patch
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" JANSSON_STATIC_CRT)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" JANSSON_BUILD_SHARED_LIBS)
# Jansson tries to random-seed its hash table with system-provided entropy.
# This is not ported to UWP yet.
if(VCPKG_TARGET_IS_UWP)
set(USE_WINDOWS_CRYPTOAPI OFF)
else()
set(USE_WINDOWS_CRYPTOAPI ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DJANSSON_STATIC_CRT=${JANSSON_STATIC_CRT}
-DJANSSON_EXAMPLES=OFF
-DJANSSON_WITHOUT_TESTS=ON
-DJANSSON_BUILD_DOCS=OFF
-DJANSSON_BUILD_SHARED_LIBS=${JANSSON_BUILD_SHARED_LIBS}
-DUSE_WINDOWS_CRYPTOAPI=${USE_WINDOWS_CRYPTOAPI}
-DJANSSON_INSTALL_CMAKE_DIR:STRING=share/jansson
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)