Skip to content

Commit

Permalink
Cmake revert to using ${Protobuf_LIBRARIES}
Browse files Browse the repository at this point in the history
Instead of protobuf::libprotobuf, which is currently
treated too inconsistently by CMake.
Also remove the exported find_dependency.
  • Loading branch information
Suan Yong committed Dec 1, 2020
1 parent 552102d commit 860cf8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions gtirbConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ function(check_gtirb_branch GTIRB_BRANCH_NAME)
endif()
endfunction()
include("${CMAKE_CURRENT_LIST_DIR}/gtirbTargets.cmake")
include(CMakeFindDependencyMacro)
find_dependency(Protobuf @Protobuf_VERSION@)
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,15 @@ target_include_directories(
${PROJECT_NAME} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src/>
)

# NOTE (2020-12): tried using protobuf::libprotobuf to get relocatable exports,
# but it is apparently treated inconsistently between static and shared builds.
# For simplicity, we revert to using ${Protobuf_LIBRARIES} for now.

target_link_libraries(
${PROJECT_NAME}
PUBLIC ${SYSLIBS}
${Boost_LIBRARIES}
protobuf::libprotobuf
${Protobuf_LIBRARIES}
# Link in this static lib, but don't make it a transitive dependency of
# TestGTIRB, etc
PRIVATE gtirb_proto
Expand Down
2 changes: 1 addition & 1 deletion src/gtirb/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ endforeach(PROTO_H)
# Add proto library target
add_library(gtirb_proto STATIC ${PROTO_CPP_SOURCES} ${PROTO_COPIED_HEADERS})

target_link_libraries(gtirb_proto ${Boost_LIBRARIES} protobuf::libprotobuf)
target_link_libraries(gtirb_proto ${Boost_LIBRARIES} ${Protobuf_LIBRARIES})

target_compile_definitions(gtirb_proto PRIVATE GTIRB_${PROJECT_NAME}_EXPORTS)

Expand Down

0 comments on commit 860cf8f

Please sign in to comment.