Skip to content

Build tests fails when included in another project with CMake FetchContent #7

@craigpepper

Description

@craigpepper

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions