CMake - 3rdparty folder and mulit module project

Viewed 61

What is good practice to create 3rdparty folder?

I have a project with multiple modules that are in scope of project, some of those modules are depending on 3rdpartys. Currently I have single 3rdparty folder in root. On top of that I've created cmake folder with Find<package>.cmake files. Then each module just call find_package if lib is necessary.

Question is if that's a good practice? Each module should have his own 3rdparty folder or now how it is currently is just fine?

To extend scope of question - I have a 3rdparty which I would like to debug.

- root/
  - 3rdparty/
    - 3rdplib/
  - mylib/
    - CmakeLists.txt
    ...

add_subdirectory sounds like nice option but 3rdplib is not in same folder as mylib.

1 Answers

I would say that what you have done is the cleanest possible way of managing 3rd party dependencies in a multi-component project.

What you presented matches perfectly the "external" directory of the Pitchfork proposal (which aims to establish/standarize typical C/C++ project structure).

Related