vcpkg/ports/date/portfile.cmake

52 lines
1.6 KiB
CMake
Raw Normal View History

2017-08-16 03:47:23 +08:00
include(vcpkg_common_functions)
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(WARNING
"You will need to also install http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml into your install location.\n"
"See https://howardhinnant.github.io/date/tz.html"
)
endif()
2017-09-01 07:06:18 +08:00
2017-08-16 03:47:23 +08:00
vcpkg_from_github(
2017-09-01 07:06:18 +08:00
OUT_SOURCE_PATH SOURCE_PATH
REPO HowardHinnant/date
REF v2.4.1
SHA512 ce7d1c4518558d3690b3a33cd3da1066b43a5f641282c331c60be73e9b010227d4998bca5f34694215ae52f6514a2f5eccd6b0a5ee3dcf8cef2f2d1644c8beee
2017-09-01 07:06:18 +08:00
HEAD_REF master
2017-08-16 03:47:23 +08:00
)
2018-02-12 17:50:04 +08:00
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-date.patch
)
2017-08-16 03:47:23 +08:00
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
set(HAS_REMOTE_API 0)
if("remote-api" IN_LIST FEATURES)
set(HAS_REMOTE_API 1)
endif()
2017-08-16 03:47:23 +08:00
vcpkg_configure_cmake(
2017-09-01 07:06:18 +08:00
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DHAS_REMOTE_API=${HAS_REMOTE_API}
2017-09-01 07:06:18 +08:00
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
2017-08-16 03:47:23 +08:00
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-date TARGET_PATH share/unofficial-date)
2017-09-01 07:06:18 +08:00
vcpkg_copy_pdbs()
2017-08-16 03:47:23 +08:00
set(HEADER "${CURRENT_PACKAGES_DIR}/include/date/tz.h")
file(READ "${HEADER}" _contents)
string(REPLACE "#define TZ_H" "#define TZ_H\n#undef HAS_REMOTE_API\n#define HAS_REMOTE_API ${HAS_REMOTE_API}" _contents "${_contents}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
string(REPLACE "ifdef DATE_BUILD_DLL" "if 1" _contents "${_contents}")
endif()
file(WRITE "${HEADER}" "${_contents}")
2017-09-01 07:06:18 +08:00
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/date RENAME copyright)