Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions Internal/StreamMisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -65,6 +68,4 @@
#define _Optional
#endif

#define NOT_USED(x) ((void)(x))

#endif /* StreamMisc_h */
7 changes: 1 addition & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
5 changes: 2 additions & 3 deletions tests/Tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#undef NDEBUG

#include "MacroUtils.h"

#ifdef FORTIFY
#include "fortify.h"
#else
Expand Down Expand Up @@ -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);
Expand Down
Loading