From a6271af33364bf583b11ab06141007a2fc221f3f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 13 Mar 2024 08:54:33 +0100 Subject: [PATCH] cmake: Create a cmake config file This way other cmake project can find the library using: find_package(piper_phonemize) --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40bcde3..6a8908c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,11 @@ project( option(BUILD_EXTERNAL "Build external dependencies" OFF) +include(CMakePackageConfigHelpers) +write_basic_package_version_file(piper_phonemize-config-version.cmake + VERSION ${piper_phonemize_VERSION} + COMPATIBILITY SameMajorVersion) + if(MSVC) # Force compiler to use UTF-8 for IPA constants add_compile_options("$<$:/utf-8>") @@ -263,8 +268,12 @@ include(GNUInstallDirs) install( TARGETS piper_phonemize + EXPORT piper_phonemize-config LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(EXPORT piper_phonemize-config + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${pipe_phonemize_NAME}) + install( DIRECTORY ${piper_phonemize_SOURCE_DIR}/src/ DESTINATION include/piper-phonemize