vcpkg/ports/abseil/portfile.cmake
2017-11-10 08:06:20 -08:00

41 lines
1.5 KiB
CMake

include(vcpkg_common_functions)
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "Abseil currently only supports being built for desktop")
endif()
message("NOTE: THIS PORT IS USING AN UNOFFICIAL BUILDSYSTEM. THE BINARY LAYOUT AND CMAKE INTEGRATION WILL CHANGE IN THE FUTURE.")
message("To use from cmake:\n find_package(unofficial-abseil REQUIRED)\n link_libraries(unofficial::abseil::strings)")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO abseil/abseil-cpp
REF 778abb7c279547afe7a4642063712f13a80b8eea
SHA512 55268321429ac5dfc432fd60e71cfac5abbc4b7145bc16bfaaff9dd05af4a3a8cb92e95906f6ebcd493f71e2fd892ddc8923011ad15fbd37ed423b70200c8538
HEAD_REF master
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-abseil)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/abseil ${CURRENT_PACKAGES_DIR}/share/unofficial-abseil)
file(GLOB_RECURSE HEADERS ${CURRENT_PACKAGES_DIR}/include/*)
foreach(FILE ${HEADERS})
file(READ "${FILE}" _contents)
string(REPLACE "std::min(" "(std::min)(" _contents "${_contents}")
string(REPLACE "std::max(" "(std::max)(" _contents "${_contents}")
file(WRITE "${FILE}" "${_contents}")
endforeach()
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/abseil RENAME copyright)