Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call external programs with CMake

Tags:

cmake

thrift

I tried to search the CMake documentation, but I couldn't figure out how to call external programs from CMake.

There are few things I want to do.

  1. Compile other third-party dependencies that uses a makefile
  2. Compile Thrift definition files to C++ / Python stubs.
  3. Compile Cython definition files.

Another question is, what is a good way to handle those cases anyway? It feels like calling a shell script directly from CMake doesn't feel so clean, when "C" in CMake stands for Cross Platform.

EDIT: I have few extra questions. Before, in my build, I prebuilt my dependencies, and the project itself used FIND_PACKAGE(...) to find the header / libraries for the dependencies.

Now, I'm ExternalProject_Add() to compile the dependencies, but the problem is, all my FindXYZ() functions fails when I run cmake ., because the dependencies aren't present when CMake gets executed.

How should I include the third-party libraries in my project in this case?

like image 850
Jeeyoung Kim Avatar asked Oct 10 '22 21:10

Jeeyoung Kim


1 Answers

  1. http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html

2+3. can be hacked with CONFIGURE_COMMAND/BUILD_COMMAND/INSTALL_COMMAND

like image 127
Anycorn Avatar answered Oct 23 '22 06:10

Anycorn