开发者

Include third party libraries in source tree

开发者 https://www.devze.com 2023-02-10 12:01 出处:网络
My CMake C++ project depends on several commercial libraries (only libs and headers are available). I want an easy way to include these packages in my source tree.

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

I have tried the following options:

  1. Use svn:externals and provide these libraries in a thirdparty folder of the source tree. Pros: easy. Cons: slow download, all or nothing.
  2. Has a README file detailing what package is required for what option 开发者_开发百科in my CMake. Developers will have to download and unpack to the right place. Pros: fast download, select only the package necessary. Cons: complicated.

Is there a way for me to deploy these packages to the developers automatically?

The workflow that I want:

  1. Developer choose an option in CMake e.g. USE_LIBRARY_A
  2. Developer hit Configure
  3. Package is downloaded and put in the right place in the source tree
  4. Developer hit Generate
  5. Solution/Makefile is ready for compilation

I guess what I want is similar to easy_install in Python or rubygems in Ruby.


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

The ExternalProject_Add command lets you automatically download, build and install third-party libraries.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号