vcpkg/ports/libconfig/portfile.cmake

47 lines
1.6 KiB
CMake
Raw Normal View History

2017-06-29 04:21:01 +08:00
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO hyperrealm/libconfig
REF v1.6
SHA512 6222110851970fda11d21e73bc322be95fb1ce62c513e2f4cc7875d7b32d1d211860971692db679edf8ac46151033a132fc669bd16590fec56360ef3a6e584f8
HEAD_REF master
)
2017-06-29 05:06:52 +08:00
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
"${CMAKE_CURRENT_LIST_DIR}/fix-scanner-source-msvc-patch.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-scanner-header-msvc-patch.patch"
)
2017-06-29 04:21:01 +08:00
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
2017-06-30 06:18:58 +08:00
file(COPY ${CMAKE_CURRENT_LIST_DIR}/scandir.c DESTINATION ${SOURCE_PATH}/lib/win32)
2017-06-29 04:21:01 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
2017-06-30 04:38:45 +08:00
2017-06-29 05:06:52 +08:00
vcpkg_install_cmake()
2017-06-29 04:21:01 +08:00
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()
2017-06-29 04:21:01 +08:00
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libconfig RENAME copyright)
2017-06-30 04:41:49 +08:00
vcpkg_copy_pdbs()