mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 03:34:26 +08:00
7be26f0f3c
Co-authored-by: Cheney-Wang <850426846@qq.com>
32 lines
1.2 KiB
CMake
32 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(Unicorn_Lib LANGUAGES CXX DESCRIPTION "Unicode library for C++ by Ross Smith")
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
option(UNICORN_LIB_SKIP_HEADERS "If the headers installation is skipped or not." OFF)
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(PCRE2 IMPORTED_TARGET REQUIRED libpcre2-8)
|
|
|
|
file(GLOB_RECURSE UNICORN_LIB_SOURCES "${PROJECT_SOURCE_DIR}/unicorn/*.cpp")
|
|
list(FILTER UNICORN_LIB_SOURCES EXCLUDE REGEX "(.*)-test.cpp(.*)")
|
|
|
|
add_library(unicorn-lib ${UNICORN_LIB_SOURCES})
|
|
target_include_directories(unicorn-lib PUBLIC "${PROJECT_SOURCE_DIR}")
|
|
target_link_libraries(unicorn-lib PRIVATE PkgConfig::PCRE2 ZLIB::ZLIB)
|
|
if(WIN32)
|
|
target_compile_definitions(unicorn-lib PRIVATE -DNOMINMAX -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_WARNINGS)
|
|
else()
|
|
find_package(Iconv REQUIRED)
|
|
target_link_libraries(unicorn-lib PRIVATE Iconv::Iconv)
|
|
target_compile_definitions(unicorn-lib PRIVATE -D_XOPEN_SOURCE=700)
|
|
endif()
|
|
|
|
if(NOT UNICORN_LIB_SKIP_HEADERS)
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/unicorn DESTINATION include FILES_MATCHING PATTERN "*.hpp")
|
|
endif()
|
|
install(TARGETS unicorn-lib
|
|
RUNTIME DESTINATION bin
|
|
LIBRARY DESTINATION lib
|
|
ARCHIVE DESTINATION lib
|
|
) |