diff --git a/CMakeLists.txt b/CMakeLists.txt index 7afe2f4..bc815b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,9 @@ option(ENABLE_CLANG_TIDY "Run clang-tidy during compilation" OFF) include(FetchContent) FetchContent_Declare(GKey GIT_REPOSITORY https://github.com/chrisbazley/GKeyLib.git GIT_TAG main) +FetchContent_Declare(CBUtil GIT_REPOSITORY https://github.com/chrisbazley/CBUtilLib.git GIT_TAG main) -FetchContent_MakeAvailable(GKey) +FetchContent_MakeAvailable(GKey CBUtil) if(USE_OPTIONAL) if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang|AppleClang") @@ -80,20 +81,12 @@ file(GLOB PUBLIC_HEADERS "*.h") file(GLOB PRIVATE_HEADERS "Internal/*.h") add_library(Stream STATIC ${SOURCES} ${PUBLIC_HEADERS} ${PRIVATE_HEADERS}) -target_link_libraries(Stream PRIVATE GKey) +target_link_libraries(Stream PRIVATE GKey CBUtil) set_target_properties(Stream PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}" DEBUG_POSTFIX "dbg" ) -if(USE_OPTIONAL) - FetchContent_Declare(CBUtil GIT_REPOSITORY https://github.com/chrisbazley/CBUtilLib.git GIT_TAG main) - - FetchContent_MakeAvailable(CBUtil) - - target_link_libraries(Stream PRIVATE CBUtil) -endif() - target_include_directories(Stream PUBLIC .) target_compile_definitions(Stream PRIVATE diff --git a/Internal/StreamMisc.h b/Internal/StreamMisc.h index 48e053b..5c1e87c 100644 --- a/Internal/StreamMisc.h +++ b/Internal/StreamMisc.h @@ -22,15 +22,18 @@ CJB: 04-Nov-18: Created this source file. CJB: 26-Aug-19: Now requires "PseudoFlex.h" too. CJB: 07-Jun-20: Added support for verbose debugging output. - CJB: 22-Sep-26: Remove a redundant include of PseudoIO.h because fortify.h - already enables standard I/O interception. CJB: 09-Apr-25: Dogfooding the _Optional qualifier. CJB: 15-Jun-26: Send the debug log to stderr not stdout. + CJB: 22-Sep-26: Remove a redundant include of PseudoIO.h because fortify.h + already enables standard I/O interception. + CJB: 22-Sep-26: Use common macro definitions from CBUtilLib. */ #ifndef StreamMisc_h #define StreamMisc_h +#include "MacroUtils.h" + #ifdef FORTIFY #include "fortify.h" #endif @@ -65,6 +68,4 @@ #define _Optional #endif -#define NOT_USED(x) ((void)(x)) - #endif /* StreamMisc_h */ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 84beeec..d778bfd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,10 +2,5 @@ file(GLOB SOURCES "*.c") file(GLOB PRIVATE_HEADERS "*.h") add_executable(StreamTests ${SOURCES} ${PRIVATE_HEADERS}) -target_link_libraries(StreamTests PRIVATE Stream) -target_link_libraries(StreamTests PRIVATE GKey) +target_link_libraries(StreamTests PRIVATE Stream GKey CBUtil) add_test(NAME "StreamTests" COMMAND StreamTests) - -if(USE_OPTIONAL) - target_link_libraries(StreamTests PRIVATE CBUtil) -endif() diff --git a/tests/Tests.h b/tests/Tests.h index 6494507..4ae186b 100644 --- a/tests/Tests.h +++ b/tests/Tests.h @@ -22,6 +22,8 @@ #undef NDEBUG +#include "MacroUtils.h" + #ifdef FORTIFY #include "fortify.h" #else @@ -51,9 +53,6 @@ #define _Optional #endif -#define NOT_USED(x) ((void)(x)) -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - extern void Reader_tests(void); extern void ReaderNull_tests(void); extern void Writer_tests(void);