vcpkg/ports/libconfig/portfile.cmake
2017-12-26 12:43:00 +08:00

39 lines
1.3 KiB
CMake

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO hyperrealm/libconfig
REF v1.7.1
SHA512 b58b468e9e2d5175fbde1ad9765c6604dc9b3f3944613a88404a45d0d232e7d79a47321bf3c06b97cb46a2104b4313fad5c7f8944149f550b7af51ad523e775e
HEAD_REF master
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
foreach(FILE ${CURRENT_PACKAGES_DIR}/include/libconfig.h++ ${CURRENT_PACKAGES_DIR}/include/libconfig.h)
file(READ ${FILE} _contents)
string(REPLACE "defined(LIBCONFIGXX_EXPORTS)" "0" _contents "${_contents}")
string(REPLACE "defined(LIBCONFIG_EXPORTS)" "0" _contents "${_contents}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
string(REPLACE "defined(LIBCONFIGXX_STATIC)" "0" _contents "${_contents}")
string(REPLACE "defined(LIBCONFIG_STATIC)" "0" _contents "${_contents}")
else()
string(REPLACE "defined(LIBCONFIGXX_STATIC)" "1" _contents "${_contents}")
string(REPLACE "defined(LIBCONFIG_STATIC)" "1" _contents "${_contents}")
endif()
file(WRITE ${FILE} "${_contents}")
endforeach()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libconfig RENAME copyright)
vcpkg_copy_pdbs()