Skip to content

Commit

Permalink
protobuf_generate
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Jan 7, 2024
1 parent 617ea9f commit 15be0b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ project(osmpbf VERSION 1.5.0)

include(GNUInstallDirs)

set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
find_package(Protobuf REQUIRED)

Expand Down
11 changes: 9 additions & 2 deletions osmpbf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
protobuf_generate_cpp(CPPS HS fileformat.proto osmformat.proto)

#protobuf_generate_cpp(CPPS HS fileformat.proto osmformat.proto)
add_library(osmpbf STATIC ${CPPS})
target_compile_features(osmpbf PUBLIC cxx_std_11)
target_link_libraries(osmpbf PRIVATE protobuf::libprotobuf)
target_include_directories(osmpbf SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS})
#set_property(TARGET osmpbf PROPERTY CXX_STANDARD 11)
install(TARGETS osmpbf ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

protobuf_generate(LANGUAGE cpp
TARGET osmpbf
PROTOS fileformat.proto osmformat.proto)

add_library(osmpbf_shared SHARED ${CPPS})
#set_property(TARGET osmpbf_shared PROPERTY CXX_STANDARD 11)
target_compile_features(osmpbf_shared PUBLIC cxx_std_11)
Expand All @@ -17,6 +20,10 @@ set_target_properties(osmpbf_shared PROPERTIES OUTPUT_NAME osmpbf
SOVERSION ${PROJECT_VERSION_MAJOR})
install(TARGETS osmpbf_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

protobuf_generate(LANGUAGE cpp
TARGET osmpbf_shared
PROTOS fileformat.proto osmformat.proto)

install(FILES ${CMAKE_SOURCE_DIR}/include/osmpbf/osmpbf.h
${CMAKE_BINARY_DIR}/osmpbf/osmformat.pb.h
${CMAKE_BINARY_DIR}/osmpbf/fileformat.pb.h
Expand Down

0 comments on commit 15be0b2

Please sign in to comment.