Skip to content

Commit

Permalink
Fixes #189: Setting VERSION and SOVERSION when building a shared …
Browse files Browse the repository at this point in the history
…printf library
  • Loading branch information
eyalroz committed Nov 22, 2024
1 parent 2d79586 commit ad05709
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,17 @@ add_library(printf)

add_library("printf::printf" ALIAS printf)


set(GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
configure_file("printf_config.h.in" "${GENERATED_INCLUDE_DIR}/printf_config.h" @ONLY)
target_sources(printf PRIVATE src/printf/printf.c "${GENERATED_INCLUDE_DIR}/printf_config.h" src/printf/printf.h)
target_compile_definitions(printf PRIVATE PRINTF_INCLUDE_CONFIG_H)
target_include_directories(printf PRIVATE "$<BUILD_INTERFACE:${GENERATED_INCLUDE_DIR}>")

if (BUILD_SHARED_LIBS)
set_property(TARGET printf PROPERTY VERSION ${PROJECT_VERSION})
set_property(TARGET printf PROPERTY SOVERSION ${PROJECT_VERSION})
endif()

set_property(TARGET printf PROPERTY C_STANDARD 99)
set_property(TARGET printf PROPERTY C_STANDARD_REQUIRED ON)
set_property(TARGET printf PROPERTY C_EXTENSIONS OFF)
Expand Down

0 comments on commit ad05709

Please sign in to comment.