Skip to content

How to add files from subdirectories ?  #8

@skipit

Description

@skipit

I was trying to extend this, by adding a directory and a cpp file in that directory and a test_*.cpp file in that directory and add it.

I used the add_subdirectory(another_dir) directive, and inside that, I added lines

1 include_directories(${CMAKE_SOURCE_DIR})
2 include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
3 add_library(another_dir test_project2.cpp)

It compiles fine.

On the toplevel CMakeLists.txt I added, target_link_library(.... , another_dir).

This was not linking the library from the subdirectory.

Can you update this git-repo on how to handle subdirectories.

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