don't build static libs at all, and link cli tools to shared -- diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 6098613..de2d56b 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -119,24 +119,18 @@ add_library (avrocpp SHARED ${AVRO_SOURCE_FILES}) set_property (TARGET avrocpp APPEND PROPERTY COMPILE_DEFINITIONS AVRO_DYN_LINK) -add_library (avrocpp_s STATIC ${AVRO_SOURCE_FILES}) -target_include_directories(avrocpp_s PRIVATE ${SNAPPY_INCLUDE_DIR}) - -set_property (TARGET avrocpp avrocpp_s +set_property (TARGET avrocpp APPEND PROPERTY COMPILE_DEFINITIONS AVRO_SOURCE) set_target_properties (avrocpp PROPERTIES VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR}.${AVRO_VERSION_PATCH}) -set_target_properties (avrocpp_s PROPERTIES - VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR}.${AVRO_VERSION_PATCH}) - target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) target_include_directories(avrocpp PRIVATE ${SNAPPY_INCLUDE_DIR}) add_executable (precompile test/precompile.cc) -target_link_libraries (precompile avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) +target_link_libraries (precompile avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) macro (gen file ns) add_custom_command (OUTPUT ${file}.hh @@ -166,7 +160,7 @@ gen (primitivetypes pt) gen (cpp_reserved_words cppres) add_executable (avrogencpp impl/avrogencpp.cc) -target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) +target_link_libraries (avrogencpp avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) enable_testing() @@ -204,7 +198,7 @@ set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}") include (CPack) -install (TARGETS avrocpp avrocpp_s +install (TARGETS avrocpp LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION lib) diff --git a/c/src/CMakeLists.txt b/c/src/CMakeLists.txt index c1761c8..6232a83 100644 --- a/c/src/CMakeLists.txt +++ b/c/src/CMakeLists.txt @@ -115,7 +115,7 @@ install(TARGETS avro-static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) else(WIN32) -install(TARGETS avro-static avro-shared +install(TARGETS avro-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -131,20 +131,20 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/avro-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) add_executable(avrocat avrocat.c) -target_link_libraries(avrocat avro-static) +target_link_libraries(avrocat avro-shared) install(TARGETS avrocat RUNTIME DESTINATION bin) add_executable(avroappend avroappend.c) -target_link_libraries(avroappend avro-static) +target_link_libraries(avroappend avro-shared) install(TARGETS avroappend RUNTIME DESTINATION bin) if (NOT WIN32) #TODO: Port getopt() to Windows to compile avropipe.c and avromod.c add_executable(avropipe avropipe.c) -target_link_libraries(avropipe avro-static) +target_link_libraries(avropipe avro-shared) install(TARGETS avropipe RUNTIME DESTINATION bin) add_executable(avromod avromod.c) -target_link_libraries(avromod avro-static) +target_link_libraries(avromod avro-shared) install(TARGETS avromod RUNTIME DESTINATION bin) endif(NOT WIN32)