Include third-party libraries in the source tree

The My CMake C ++ project depends on several commercial libraries (only libraries and headers are available). I want an easy way to include these packages in my source tree.

I tried the following options:

  • Use svn: externals and provide these libraries in the thirdparty folder of the source tree. Pros: easy. Cons: slow loading, all or nothing.
  • There is a README file that describes in detail which package is needed for which option in my CMake. Developers will have to download and unzip the right places. Pros: fast download, select only the necessary package. Cons: complicated.

Is there a way to deploy these packages to developers automatically?

The workflow I want is:

  • The developer chooses an option in CMake, for example. USE_LIBRARY_A
  • Arrival of Configure Developer
  • The package is downloaded and placed in the right place in the source tree
  • Developer hit Generate
  • Solution / Makefile ready to compile

I assume that what I want is like easy_install in Python or rubygems in Ruby.

+4
source share
1 answer

The desired workflow can be achieved by adding third-party libraries as external CMake projects .

The ExternalProject_Add command allows you to automatically download, create and install third-party libraries.

+1
source

Source: https://habr.com/ru/post/1339590/


All Articles