mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-23 19:07:49 +08:00
4b45f9b56d
Check VCPKG_CMAKE_SYSTEM_NAME prior to performing Windows-specific actions in portfiles Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
48 lines
2.0 KiB
CMake
48 lines
2.0 KiB
CMake
include(vcpkg_common_functions)
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO fmtlib/fmt
|
|
REF 5.3.0
|
|
SHA512 9ef0f3d328681253c1e1776576d54d67dec49c19fd7fc422ae63c3610b01a3f05f6e83cdf5e913dfd09bac42e52fe35c38ebe1ea91f4207d226a32aaf69eb4a8
|
|
HEAD_REF master
|
|
)
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
-DFMT_CMAKE_DIR=share/fmt
|
|
-DFMT_TEST=OFF
|
|
-DFMT_DOC=OFF
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
file(INSTALL ${SOURCE_PATH}/LICENSE.rst DESTINATION ${CURRENT_PACKAGES_DIR}/share/fmt RENAME copyright)
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME)
|
|
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
|
|
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/fmt.dll ${CURRENT_PACKAGES_DIR}/bin/fmt.dll)
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/fmtd.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fmtd.dll)
|
|
endif()
|
|
|
|
# Force FMT_SHARED to 1
|
|
file(READ ${CURRENT_PACKAGES_DIR}/include/fmt/core.h FMT_CORE_H)
|
|
string(REPLACE "defined(FMT_SHARED)" "1" FMT_CORE_H "${FMT_CORE_H}")
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/include/fmt/core.h "${FMT_CORE_H}")
|
|
endif()
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
vcpkg_fixup_cmake_targets()
|
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME)
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake FMT_DEBUG_MODULE)
|
|
string(REPLACE "lib/fmtd.dll" "bin/fmtd.dll" FMT_DEBUG_MODULE ${FMT_DEBUG_MODULE})
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake "${FMT_DEBUG_MODULE}")
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-release.cmake FMT_RELEASE_MODULE)
|
|
string(REPLACE "lib/fmt.dll" "bin/fmt.dll" FMT_RELEASE_MODULE ${FMT_RELEASE_MODULE})
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-release.cmake "${FMT_RELEASE_MODULE}")
|
|
endif()
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
|
|
vcpkg_copy_pdbs()
|