aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackBoosY <47264268+JackBoosY@users.noreply.github.com>2019-05-24 12:54:24 +0800
committerPhil Christensen <philc@microsoft.com>2019-05-23 21:54:24 -0700
commit9d623319c6026013096cf5387cba2445d5f49bad (patch)
treefa57fedf082d5a656a44fe7c72b33e237a191218
parentd0f97f7daed680ed3239092b0d67d51d8cfe225e (diff)
downloadvcpkg-9d623319c6026013096cf5387cba2445d5f49bad.tar.gz
vcpkg-9d623319c6026013096cf5387cba2445d5f49bad.zip
[unicorn-lib]Fix build error. (#6534)
* [unicorn-lib]Fix build error. * [unicorn-lib]Changed library linkage to static. * [unicorn-lib]Use find_package instead of find_library to find zlib. * [unicorn-lib]Fix the name of the PCRE2 library under debug/release and modify ZLIB link name. * [unicorn-lib]Use select_library_configurations to select which pcre2 library should be linked.
-rw-r--r--ports/unicorn-lib/CMakeLists.txt13
-rw-r--r--ports/unicorn-lib/CONTROL2
-rw-r--r--ports/unicorn-lib/portfile.cmake7
3 files changed, 20 insertions, 2 deletions
diff --git a/ports/unicorn-lib/CMakeLists.txt b/ports/unicorn-lib/CMakeLists.txt
index b34e04f23..9a9c5825e 100644
--- a/ports/unicorn-lib/CMakeLists.txt
+++ b/ports/unicorn-lib/CMakeLists.txt
@@ -6,6 +6,10 @@ option(UNICORN_LIB_SKIP_HEADERS "If the headers installation is skipped or not."
find_path(RS_CORE_LIB_INCLUDE_DIR rs-core/common.hpp)
#find_library(RW_UTILITIES_LIBRARY NAMES rw_utilities)
+find_package(ZLIB REQUIRED)
+find_library(PCRE2_LIBRARY_DEBUG NAMES pcre2-8d HINTS ${INSTALLED_LIB_PATH})
+find_library(PCRE2_LIBRARY_RELEASE NAMES pcre2-8 HINTS ${INSTALLED_LIB_PATH})
+select_library_configurations(PCRE2)
file(GLOB_RECURSE UNICORN_LIB_SOURCES ${PROJECT_SOURCE_DIR}/unicorn/*.cpp)
foreach(ITR ${UNICORN_LIB_SOURCES})
@@ -24,7 +28,14 @@ target_compile_definitions(
PRIVATE -DUNICODE -D_UNICODE _CRT_SECURE_NO_WARNINGS
)
+target_link_libraries(unicorn-lib PUBLIC ${PCRE2_LIBRARY})
+target_link_libraries(unicorn-lib PUBLIC ZLIB::ZLIB)
+
if(NOT UNICORN_LIB_SKIP_HEADERS)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/unicorn DESTINATION include FILES_MATCHING PATTERN "*.hpp")
endif()
-install(TARGETS unicorn-lib DESTINATION lib) \ No newline at end of file
+install(TARGETS unicorn-lib
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ ) \ No newline at end of file
diff --git a/ports/unicorn-lib/CONTROL b/ports/unicorn-lib/CONTROL
index aa03f5148..655dd26d7 100644
--- a/ports/unicorn-lib/CONTROL
+++ b/ports/unicorn-lib/CONTROL
@@ -1,4 +1,4 @@
Source: unicorn-lib
-Version: 2019-05-07
+Version: 2019-05-07-1
Description: Unicode library for C++ by Ross Smith
Build-Depends: rs-core-lib, pcre2, zlib, libiconv
diff --git a/ports/unicorn-lib/portfile.cmake b/ports/unicorn-lib/portfile.cmake
index 8c298ca7f..dff094ef8 100644
--- a/ports/unicorn-lib/portfile.cmake
+++ b/ports/unicorn-lib/portfile.cmake
@@ -1,5 +1,10 @@
include(vcpkg_common_functions)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ message("unicorn-lib is a static library, now build with static.")
+ set(VCPKG_LIBRARY_LINKAGE static)
+endif()
+
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO CaptainCrowbar/unicorn-lib
@@ -20,5 +25,7 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/unicorn-lib RENAME copyright) \ No newline at end of file