Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only include utf8_range if it hasn't been included already #12301

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion cmake/libprotobuf-lite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ set_target_properties(libprotobuf-lite PROPERTIES
)
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)

target_include_directories(libprotobuf-lite PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range)
target_link_libraries(libprotobuf-lite PRIVATE utf8_validity)
1 change: 0 additions & 1 deletion cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ set_target_properties(libprotobuf PROPERTIES
)
add_library(protobuf::libprotobuf ALIAS libprotobuf)

target_include_directories(libprotobuf PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range)
target_link_libraries(libprotobuf PRIVATE utf8_validity)
19 changes: 11 additions & 8 deletions cmake/utf8_range.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Disable utf8_range tests")
if (NOT TARGET utf8_range)
set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Disable utf8_range tests")

if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/utf8_range/CMakeLists.txt")
message(FATAL_ERROR
"Cannot find third_party/utf8_range directory that's needed for "
"the protobuf runtime.\n")
endif()
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/utf8_range/CMakeLists.txt")
message(FATAL_ERROR
"Cannot find third_party/utf8_range directory that's needed for "
"the protobuf runtime.\n")
endif()

set(utf8_range_ENABLE_INSTALL ${protobuf_INSTALL} CACHE BOOL "Set install")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range third_party/utf8_range)
set(utf8_range_ENABLE_INSTALL ${protobuf_INSTALL} CACHE BOOL "Set install")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range third_party/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()")