2016-10-27 03:18:53 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
2016-11-09 06:38:47 +08:00
|
|
|
message(STATUS "Warning: Dynamic building not supported. Building static.") # See note below
|
|
|
|
set(VCPKG_LIBRARY_LINKAGE static)
|
2016-10-27 03:18:53 +08:00
|
|
|
endif()
|
2016-10-24 04:44:46 +08:00
|
|
|
include(vcpkg_common_functions)
|
2018-03-30 01:57:32 +08:00
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH CMAKE_SOURCE_PATH
|
|
|
|
REPO noloader/cryptopp-cmake
|
|
|
|
REF aab149932675e4bb777a9d3d6b3f8b8182583fd7
|
|
|
|
SHA512 748c77e936888d042bf4a72cc7ee3b7b2ecf16c003cb23296c1af413c9a0cba00cc942ecace26274fc8ac8bd4d848946beb9d7bf2253c5eab3315a4419ef5f1f
|
|
|
|
HEAD_REF master
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO weidai11/cryptopp
|
|
|
|
REF CRYPTOPP_6_1_0
|
|
|
|
SHA512 4bc02fef33f1859a07434a4752c2575afd781056e9a91eed99a13cebe2c91d66cbc7173e34d362da63dad6d38f9594ff291accd27e111232996ccd536bba0f39
|
|
|
|
HEAD_REF master
|
2016-10-24 04:44:46 +08:00
|
|
|
)
|
2018-03-30 01:57:32 +08:00
|
|
|
|
|
|
|
file(COPY ${CMAKE_SOURCE_PATH}/cryptopp-config.cmake DESTINATION ${SOURCE_PATH})
|
|
|
|
file(COPY ${CMAKE_SOURCE_PATH}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
2016-10-24 04:44:46 +08:00
|
|
|
|
2018-03-30 09:34:38 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
PATCHES
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/patch.patch"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/cmake.patch"
|
|
|
|
)
|
|
|
|
|
2016-10-24 04:44:46 +08:00
|
|
|
# Dynamic linking should be avoided for Crypto++ to reduce the attack surface,
|
|
|
|
# so generate a static lib for both dynamic and static vcpkg targets.
|
|
|
|
# See also:
|
|
|
|
# https://www.cryptopp.com/wiki/Visual_Studio#Dynamic_Runtime_Linking
|
|
|
|
# https://www.cryptopp.com/wiki/Visual_Studio#The_DLL
|
|
|
|
|
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2018-03-30 01:57:32 +08:00
|
|
|
PREFER_NINJA
|
2016-10-24 04:44:46 +08:00
|
|
|
OPTIONS
|
|
|
|
-DBUILD_SHARED=OFF
|
|
|
|
-DBUILD_STATIC=ON
|
|
|
|
-DBUILD_TESTING=OFF
|
|
|
|
-DBUILD_DOCUMENTATION=OFF
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
2018-03-30 01:57:32 +08:00
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/cryptopp)
|
2016-10-24 04:44:46 +08:00
|
|
|
|
|
|
|
# There is no way to suppress installation of the headers and resource files in debug build.
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
|
|
|
|
# Handle copyright
|
|
|
|
file(COPY ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cryptopp)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/cryptopp/License.txt ${CURRENT_PACKAGES_DIR}/share/cryptopp/copyright)
|