Skip to content

How to avoid the root's CMakeLists.txt? #2

@alexisfrjp

Description

@alexisfrjp

Thanks for your example project, that helped me a lot in the CMake chaos.
I have the same hierarchy and I was lost between the use of all the functions, especially with find_package().

How can we avoid the root's CMakeLists.txt that glues the app and the libs together?

Because I have several apps that use different libraries, there is a problem.
It would be nice to be able to compile the app directly inside the app folder.

  1. Either we link the lib in the app's CMakeLists.txt using add_subdirectories(../libs) but that's considered anti-pattern.
    1.1. Pro: At the app compilation, the libs are compiled too.
  2. We somehow export the libs without installing them and import them in the app CMakeLists.txt with find_package()/find_libraries()
    2.1. It seems the find_*() don't trigger the compilation of those libraries and they need to be installed in the OS, what I don't want to do.

Any thought on that?

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