How to Integrate a CMake Project with GYP-Based Libraries
Asked Answered
F

2

14

I've been building cross-platform applications using C++ and CMake. Unfortunately many libraries do not include CMake project descriptions. For example Google supported projects frequently use GYP.

Here are some of the approaches I've taken for this problem:

  1. Find a CMake project description for the library on the web
  2. Write a project description using CMake

Finding or writing CMakeLists.txt descriptions for libraries is a maintenance problem. As the library is updated, so too must my CMake description. Also the project files created by the library's authors are more likely to be correct.

How specifically should I integrate GYP projects into my CMake-based software? Is duplicating the project description in CMake the best approach, or is there some feature of CMake that I am missing?

What are some of the general approaches to dealing with this class of problems in CMake? What about libraries that include a set of project files for various platforms/IDEs? Does CMake provide a way to integrate these projects into mine?

Freehearted answered 6/3, 2014 at 2:51 Comment(0)
R
5

Use the ExternalProject module

http://www.cmake.org/cmake/help/v3.0/module/ExternalProject.html

Rundown answered 6/3, 2014 at 8:22 Comment(0)
B
5

Not sure if the output is usable for your purposes but gyp can generate Cmake projects gyp -f cmake mygypfile.gyp. Your CMakeLists.txt will be in out/[Configuration] (configuration can be Debug, Release, etc)

Basis answered 10/2, 2015 at 22:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.