enable static library to rttr (#7359)

This commit is contained in:
Hendra Darwintha 2019-07-23 00:37:38 +07:00 committed by Victor Romero
parent a97f42cf0b
commit 36112264bc

View File

@ -1,7 +1,5 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO rttrorg/rttr
@ -13,12 +11,20 @@ vcpkg_from_github(
remove-owner-read-perms.patch
)
#Handle static lib
set(BUILD_STATIC_LIB OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(BUILD_STATIC_LIB ON)
else()
set(BUILD_STATIC_LIB OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_BENCHMARKS=OFF
-DBUILD_UNIT_TESTS=OFF
-DBUILD_STATIC=${BUILD_STATIC_LIB}
)
vcpkg_install_cmake()
@ -31,6 +37,11 @@ else()
message(FATAL_ERROR "RTTR does not support this platform")
endif()
#Handle static lib
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
#Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/rttr)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/rttr/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/rttr/copyright)