logfault icon indicating copy to clipboard operation
logfault copied to clipboard

Build tests fails when included in another project with CMake FetchContent

Open craigpepper opened this issue 1 year ago • 1 comments

When logfault is included in another project via CMake FetchContent, compilation of general_tests.cpp fails with logfault.h not found

FetchContent_Declare(
    logfault
    GIT_REPOSITORY https://github.com/jgaa/logfault
)
FetchContent_MakeAvailable(logfault)
target_link_libraries( myProgram PRIVATE logfault )

This is due to the include_directories statement using CMAKE_SOURCE_DIR rather than PROJECT_SOURCE_DIR

It would also be desirable to add a CMake option to omit building tests.

craigpepper avatar Sep 26 '23 04:09 craigpepper

@craigpepper I merged your PR for this. Thank you!

jgaa avatar Sep 29 '23 06:09 jgaa