--- CMakeLists.txt.orig 2024-05-09 19:42:48 UTC +++ CMakeLists.txt @@ -89,8 +89,9 @@ set(compile_options # Main library -add_library("${PROJECT_NAME}") +add_library("${PROJECT_NAME}" SHARED) add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") +add_library("${PROJECT_NAME}_static" STATIC) target_sources("${PROJECT_NAME}" PRIVATE ${source_files}) @@ -100,11 +101,21 @@ target_compile_options("${PROJECT_NAME}" PRIVATE ${com target_compile_options("${PROJECT_NAME}" PRIVATE ${compile_options}) +target_sources("${PROJECT_NAME}_static" PRIVATE ${source_files}) + +target_include_directories("${PROJECT_NAME}_static" + PUBLIC $ + $) + +target_compile_options("${PROJECT_NAME}_static" PRIVATE ${compile_options}) + +set_target_properties("${PROJECT_NAME}_static" PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") + # Installation set(targets_export_name "${PROJECT_NAME}-targets") -install(TARGETS "${PROJECT_NAME}" +install(TARGETS "${PROJECT_NAME}" "${PROJECT_NAME}_static" EXPORT "${targets_export_name}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")