diff --git a/CMakeLists.txt b/CMakeLists.txt index 147d012..22e8ef1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ 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) add_subdirectory(osmpbf) diff --git a/osmpbf/CMakeLists.txt b/osmpbf/CMakeLists.txt index 80446f2..31f93a2 100644 --- a/osmpbf/CMakeLists.txt +++ b/osmpbf/CMakeLists.txt @@ -2,6 +2,7 @@ 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}) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index c7e7002..59e04e0 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -9,7 +9,7 @@ add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64) add_executable(osmpbf-outline osmpbf-outline.cpp) target_include_directories(osmpbf-outline SYSTEM PRIVATE ${ZLIB_INCLUDE_DIR}) -target_link_libraries(osmpbf-outline PRIVATE osmpbf ZLIB::ZLIB protobuf::libprotobuf) +target_link_libraries(osmpbf-outline PRIVATE osmpbf ZLIB::ZLIB) set_property(TARGET osmpbf-outline PROPERTY CXX_STANDARD 11) install(TARGETS osmpbf-outline RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})