mirror of
https://github.com/reactos/CMake.git
synced 2025-02-08 21:09:48 +00:00
Merge topic 'FindProtobuf-threads'
03454b0d0d FindProtobuf: Add missing link dependencies on threads Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2551
This commit is contained in:
commit
133465a0e5
@ -382,21 +382,16 @@ function(_protobuf_find_libraries name filename)
|
|||||||
mark_as_advanced(${name}_LIBRARY_DEBUG)
|
mark_as_advanced(${name}_LIBRARY_DEBUG)
|
||||||
|
|
||||||
select_library_configurations(${name})
|
select_library_configurations(${name})
|
||||||
|
|
||||||
|
if(UNIX AND Threads_FOUND)
|
||||||
|
list(APPEND ${name}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE)
|
set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE)
|
||||||
set(${name}_LIBRARIES "${${name}_LIBRARIES}" PARENT_SCOPE)
|
set(${name}_LIBRARIES "${${name}_LIBRARIES}" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Internal function: find threads library
|
|
||||||
function(_protobuf_find_threads)
|
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
||||||
find_package(Threads)
|
|
||||||
if(Threads_FOUND)
|
|
||||||
list(APPEND Protobuf_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
set(Protobuf_LIBRARIES "${Protobuf_LIBRARIES}" PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Main.
|
# Main.
|
||||||
#
|
#
|
||||||
@ -417,6 +412,11 @@ if(MSVC)
|
|||||||
find_path(Protobuf_SRC_ROOT_FOLDER protobuf.pc.in)
|
find_path(Protobuf_SRC_ROOT_FOLDER protobuf.pc.in)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
# Protobuf headers may depend on threading.
|
||||||
|
find_package(Threads QUIET)
|
||||||
|
endif()
|
||||||
|
|
||||||
# The Protobuf library
|
# The Protobuf library
|
||||||
_protobuf_find_libraries(Protobuf protobuf)
|
_protobuf_find_libraries(Protobuf protobuf)
|
||||||
#DOC "The Google Protocol Buffers RELEASE Library"
|
#DOC "The Google Protocol Buffers RELEASE Library"
|
||||||
@ -431,10 +431,6 @@ if(MSVC)
|
|||||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${Protobuf_ORIG_FIND_LIBRARY_PREFIXES}")
|
set(CMAKE_FIND_LIBRARY_PREFIXES "${Protobuf_ORIG_FIND_LIBRARY_PREFIXES}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
_protobuf_find_threads()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Find the include directory
|
# Find the include directory
|
||||||
find_path(Protobuf_INCLUDE_DIR
|
find_path(Protobuf_INCLUDE_DIR
|
||||||
google/protobuf/service.h
|
google/protobuf/service.h
|
||||||
@ -522,6 +518,10 @@ if(Protobuf_INCLUDE_DIR)
|
|||||||
set_target_properties(protobuf::libprotobuf PROPERTIES
|
set_target_properties(protobuf::libprotobuf PROPERTIES
|
||||||
IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}")
|
IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}")
|
||||||
endif()
|
endif()
|
||||||
|
if(UNIX AND TARGET Threads::Threads)
|
||||||
|
set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
|
||||||
|
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -546,6 +546,10 @@ if(Protobuf_INCLUDE_DIR)
|
|||||||
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
|
set_target_properties(protobuf::libprotobuf-lite PROPERTIES
|
||||||
IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}")
|
IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}")
|
||||||
endif()
|
endif()
|
||||||
|
if(UNIX AND TARGET Threads::Threads)
|
||||||
|
set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
|
||||||
|
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -570,6 +574,10 @@ if(Protobuf_INCLUDE_DIR)
|
|||||||
set_target_properties(protobuf::libprotoc PROPERTIES
|
set_target_properties(protobuf::libprotoc PROPERTIES
|
||||||
IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}")
|
IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}")
|
||||||
endif()
|
endif()
|
||||||
|
if(UNIX AND TARGET Threads::Threads)
|
||||||
|
set_property(TARGET protobuf::libprotoc APPEND PROPERTY
|
||||||
|
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user