From 4374b9a535da94ecfa3475387b4835bc8c840c1c Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Sat, 2 Jan 2021 21:59:19 +0100 Subject: [PATCH] Build both static and shared library --- src/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a28410f..b5a0827 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,11 +2,15 @@ protobuf_generate_cpp(CPPS HS fileformat.proto osmformat.proto) add_library(osmpbf STATIC ${CPPS}) target_include_directories(osmpbf SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS}) +install(TARGETS osmpbf ARCHIVE DESTINATION lib) + +add_library(osmpbf_shared SHARED ${CPPS}) +target_include_directories(osmpbf_shared SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS}) +set_target_properties(osmpbf_shared PROPERTIES OUTPUT_NAME osmpbf) +install(TARGETS osmpbf_shared LIBRARY DESTINATION lib) install(FILES ${CMAKE_SOURCE_DIR}/include/osmpbf/osmpbf.h ${CMAKE_BINARY_DIR}/osmpbf/osmformat.pb.h ${CMAKE_BINARY_DIR}/osmpbf/fileformat.pb.h DESTINATION "include/osmpbf") -install(TARGETS osmpbf ARCHIVE DESTINATION lib) -