vcpkg/ports/hash-library/portfile.cmake
Kai Pastor 47633daa65
[vcpkg-scripts] Catch use of ambiguous cmake vars (#34546)
Avoid wrong use of popular but ambiguous variables (`WIN32` etc.) in
scripts and portfiles by detection in CI.

Sometimes the variables are used wrongly, and sometimes this isn't
caught in PR review. This PR tries to catch those variables (when in the
active code path in script mode). [This can happen to every
contributor](https://github.com/microsoft/vcpkg/pull/34356#discussion_r1360074122),
even if he/she knows the rules ... vcpkg is raising the bar higher than
usual, having to deal with targets and hosts even in script mode.

(`b2-options.cmake` (boost fragment) shows where we get if we don't pay
attention: the same code being used in script mode (`WIN32` meaning
host) and in project mode (`WIN32` meaning target).)

The new check doesn't break any user builds because it relies on command
line options. However it changes the ABI hashes.
2024-06-14 11:40:01 -07:00

27 lines
845 B
CMake

if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO stbrumme/hash-library
REF hash_library_v8
SHA512 1c428710c0c3e4d5d1114d757a5d9145ed12c7e2fbbfa51635f43a349ddb5634bdf49e8d8fdbc7576e90b319989fb85efec433bb43ddb551c2cf29a8e80ba78b
HEAD_REF master
PATCHES
001-fix-macos.patch
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME "unofficial-${PORT}" CONFIG_PATH "share/unofficial-${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)