diff --git a/CMakeLists.txt b/CMakeLists.txt index 4137ce2e9..f1289e08a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,6 +294,7 @@ endif (protobuf_BUILD_TESTS) include(${protobuf_SOURCE_DIR}/cmake/abseil-cpp.cmake) if (protobuf_BUILD_PROTOBUF_BINARIES) + find_package(utf8_range CONFIG REQUIRED) include(${protobuf_SOURCE_DIR}/cmake/utf8_range.cmake) include(${protobuf_SOURCE_DIR}/cmake/libprotobuf-lite.cmake) if (NOT DEFINED protobuf_LIB_PROTOBUF_LITE) diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake index f343458cf..f4b1e0faa 100644 --- a/cmake/libprotobuf-lite.cmake +++ b/cmake/libprotobuf-lite.cmake @@ -42,4 +42,4 @@ set_target_properties(libprotobuf-lite PROPERTIES ) add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) -target_link_libraries(libprotobuf-lite PRIVATE utf8_validity) +target_link_libraries(libprotobuf-lite PRIVATE utf8_range::utf8_validity) diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index 422754a1a..fa9956685 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -45,4 +45,4 @@ set_target_properties(libprotobuf PROPERTIES ) add_library(protobuf::libprotobuf ALIAS libprotobuf) -target_link_libraries(libprotobuf PRIVATE utf8_validity) +target_link_libraries(libprotobuf PRIVATE utf8_range::utf8_validity) diff --git a/cmake/utf8_range.cmake b/cmake/utf8_range.cmake index f411a8c5b..21bf8235b 100644 --- a/cmake/utf8_range.cmake +++ b/cmake/utf8_range.cmake @@ -1,4 +1,4 @@ -if (NOT TARGET utf8_range) +if (0) set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Disable utf8_range tests") if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/utf8_range/CMakeLists.txt") @@ -12,4 +12,4 @@ if (NOT TARGET utf8_range) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range) endif () -set(_protobuf_FIND_UTF8_RANGE "if(NOT TARGET utf8_range)\n find_package(utf8_range CONFIG)\nendif()") +set(_protobuf_FIND_UTF8_RANGE "if(NOT TARGET utf8_range::utf8_range)\n find_package(utf8_range CONFIG)\nendif()")