From 15be0b2caad048d9d632f585c6c2097c6fcf7e4d Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Sun, 7 Jan 2024 16:42:53 +0100 Subject: [PATCH] protobuf_generate --- CMakeLists.txt | 1 - osmpbf/CMakeLists.txt | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22e8ef1..63de0f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/osmpbf/CMakeLists.txt b/osmpbf/CMakeLists.txt index 31f93a2..08f2498 100644 --- a/osmpbf/CMakeLists.txt +++ b/osmpbf/CMakeLists.txt @@ -1,5 +1,4 @@ -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) @@ -7,6 +6,10 @@ 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) @@ -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