forked from mpaland/printf
-
Notifications
You must be signed in to change notification settings - Fork 58
Closed
Labels
resolved-on-developA changeset fixing this issue has been commiutted to the development branchA changeset fixing this issue has been commiutted to the development branchtask
Description
Hello! Thank you, @eyalroz, for continuing the project.
I prefer the fork, since it supports CMake. Likewise, I use it with FetchContent
:
function(ProvidePrintfLibrary)
include(FetchContent)
set(BUILD_STATIC_LIBRARY ON)
set(SUPPORT_EXPONENTIAL_SPECIFIERS OFF)
set(SUPPORT_LONG_LONG OFF)
set(ALIAS_STANDARD_FUNCTION_NAMES OFF)
set(DEFAULT_FLOAT_PRECISION "3")
set(MAX_INTEGRAL_DIGITS_FOR_DECIMAL "3")
FetchContent_Declare(printf_library
GIT_REPOSITORY https://github.com/eyalroz/printf.git
GIT_TAG v5.0.0
)
FetchContent_MakeAvailable(printf_library)
FetchContent_GetProperties(printf_library SOURCE_DIR printf_source_dir)
target_include_directories(printf PUBLIC $<BUILD_INTERFACE:${printf_source_dir}>)
endfunction()
I would like to address some miscellaneous issues which I had to bypass:
- I use the
function
here to set the local variables to not mutate the parent scope. "Normal variables" are used instead of options. There might be a risk that the name ofBUILD_STATIC_LIBRARY
may clash with other libraries/dependencies - it's quite general. I would prefer to make the name more specific by adding aPRINTF_
prefix to the options, so the variables could be preset by the user also with theoption
command. - I had to propagate
BUILD_INTERFACE
include directory, because using#include "printf.h"
causes a compile error, since no include directories are propagated by the library. - Some variables in the config mismatch the names used in the code. One example is
PRINTF_INTEGER_BUFFER_SIZE
CMake option. In the code, it isPRINT_INTEGER_BUFFER_SIZE
. It means that the change to the former doesn't affect the latter.
I will create a PR that addresses the issue.
Metadata
Metadata
Assignees
Labels
resolved-on-developA changeset fixing this issue has been commiutted to the development branchA changeset fixing this issue has been commiutted to the development branchtask