--- CMakeLists.txt.orig 2023-08-21 13:36:24 UTC +++ CMakeLists.txt @@ -122,12 +122,15 @@ endif() file(GLOB_RECURSE BROTLI_COMMON_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} c/common/*.c) add_library(brotlicommon ${BROTLI_COMMON_SOURCES}) +add_library(brotlicommonstatic STATIC ${BROTLI_COMMON_SOURCES}) file(GLOB_RECURSE BROTLI_DEC_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} c/dec/*.c) add_library(brotlidec ${BROTLI_DEC_SOURCES}) +add_library(brotlidecstatic STATIC ${BROTLI_DEC_SOURCES}) file(GLOB_RECURSE BROTLI_ENC_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} c/enc/*.c) add_library(brotlienc ${BROTLI_ENC_SOURCES}) +add_library(brotliencstatic STATIC ${BROTLI_ENC_SOURCES}) # Older CMake versions does not understand INCLUDE_DIRECTORIES property. include_directories(${BROTLI_INCLUDE_DIRS}) @@ -152,6 +155,10 @@ foreach(lib ${BROTLI_LIBRARIES_CORE}) set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$") endforeach() +set_property(TARGET brotlicommonstatic PROPERTY OUTPUT_NAME brotlicommon) +set_property(TARGET brotlidecstatic PROPERTY OUTPUT_NAME brotlidec) +set_property(TARGET brotliencstatic PROPERTY OUTPUT_NAME brotlienc) + if(NOT BROTLI_EMSCRIPTEN) target_link_libraries(brotlidec brotlicommon) target_link_libraries(brotlienc brotlicommon) @@ -185,7 +192,9 @@ if(NOT BROTLI_BUNDLED_MODE) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ) - + install(TARGETS brotlicommonstatic ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(TARGETS brotlidecstatic ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(TARGETS brotliencstatic ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") install( DIRECTORY ${BROTLI_INCLUDE_DIRS}/brotli DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"