diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2023-02-01 15:29:14 +0800 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2023-02-01 15:29:14 +0800 |
commit | dd2fde2aa87372189e2548ef556b50a0b8ee45f2 (patch) | |
tree | 8d8c4461b6b4ec0b7f617d1b2dc3f48766730242 /lib/utfcpp/v3/CMakeLists.txt | |
parent | 782fdb71b4c6131927317c0de72f3b72a2d37258 (diff) | |
download | fork-ledger-dd2fde2aa87372189e2548ef556b50a0b8ee45f2.tar.gz fork-ledger-dd2fde2aa87372189e2548ef556b50a0b8ee45f2.tar.bz2 fork-ledger-dd2fde2aa87372189e2548ef556b50a0b8ee45f2.zip |
Updated lib/utfcpp
* Squashed 'lib/utfcpp/' content from commit 79835a5fa
git-subtree-dir: lib/utfcpp
git-subtree-split: 79835a5fa57271f07a90ed36123e30ae9741178e
* Change include path to utfcpp
Diffstat (limited to 'lib/utfcpp/v3/CMakeLists.txt')
-rw-r--r-- | lib/utfcpp/v3/CMakeLists.txt | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/utfcpp/v3/CMakeLists.txt b/lib/utfcpp/v3/CMakeLists.txt new file mode 100644 index 00000000..c8d4b7a3 --- /dev/null +++ b/lib/utfcpp/v3/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required (VERSION 3.0.2) +project (utf8cpp VERSION 3.2.2 LANGUAGES CXX) + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(IS_ROOT_PROJECT ON) +else() + set(IS_ROOT_PROJECT OFF) +endif() + +option(UTF8_TESTS "Enable tests for UTF8-CPP" ${IS_ROOT_PROJECT}) +option(UTF8_INSTALL "Enable installation for UTF8-CPP" ${IS_ROOT_PROJECT}) +option(UTF8_SAMPLES "Enable building samples for UTF8-CPP" ${IS_ROOT_PROJECT}) + +add_library(utf8cpp INTERFACE) +target_include_directories(utf8cpp INTERFACE + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/source>" + $<INSTALL_INTERFACE:include/utf8cpp> +) +add_library(utf8::cpp ALIAS utf8cpp) + +if(UTF8_INSTALL) + include(CMakePackageConfigHelpers) + if(MSVC) + set(DEF_INSTALL_CMAKE_DIR CMake) + else() + include(GNUInstallDirs) # define CMAKE_INSTALL_* + set(DEF_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/utf8cpp) + endif() + + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/utf8cppConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion + ) + + configure_package_config_file( + ${PROJECT_SOURCE_DIR}/utf8cppConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/utf8cppConfig.cmake + INSTALL_DESTINATION ${DEF_INSTALL_CMAKE_DIR} + ) + + install(DIRECTORY source/ DESTINATION include/utf8cpp) + install(TARGETS utf8cpp EXPORT utf8cppTargets) + install(EXPORT utf8cppTargets DESTINATION ${DEF_INSTALL_CMAKE_DIR}) + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/utf8cppConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/utf8cppConfigVersion.cmake + DESTINATION + ${DEF_INSTALL_CMAKE_DIR} + ) +endif() + +if(UTF8_SAMPLES) + add_executable(docsample ${PROJECT_SOURCE_DIR}/samples/docsample.cpp) + target_link_libraries(docsample PRIVATE utf8::cpp) +endif() + +if(UTF8_TESTS) + enable_testing() + add_subdirectory(tests) +endif() |