Questions tagged [external-project]

CMake's support for obtaining, building and installation of projects distinct from the one currently being processed.

The build management tool CMake supports obtaining, building and installing projects - distinct and separate from the current one it is processing - using the ExternalProjcect() command.

Use this tag for questions regarding this feature.

106 questions
142
votes
7 answers

CMake: How to build external projects and include their targets

I have a Project A that exports a static library as a target: install(TARGETS alib DESTINATION lib EXPORT project_a-targets) install(EXPORT project_a-targets DESTINATION lib/alib) Now I want to use Project A as an external project from Project B…
mirkokiefer
  • 3,347
  • 4
  • 20
  • 25
66
votes
6 answers

CMake - linking to library downloaded from ExternalProject_add()

I am trying to use ExternalProject_add() to download/install dependencies. It installs fine, but I can't figure out how to actually link the libraries after they are downloaded. I want to call target_link_libraries() on the library that was just…
Brett Thomas
  • 1,694
  • 3
  • 15
  • 21
42
votes
3 answers

CMake ExternalProject_Add() and FindPackage()

Is there are proper way to find a library (via FindPackage()) which was built with ExternalProject_Add()? The problem is that CMake cannot find the library at CMake-time because the external library gets build at compile time. I know that it is…
Lars Bilke
  • 4,940
  • 6
  • 45
  • 63
41
votes
2 answers

How do I use CMake ExternalProject_Add or alternatives in a cross-platform way?

I would like to build a third-party project that already has CMake as part of my project's CMake strips. ExternalProject_Add is for this purpose, but I have found it can only be made to work with a specific generator, and I wanted it to work on many…
Andrew Hundt
  • 2,551
  • 2
  • 32
  • 64
32
votes
2 answers

Unknown CMake command "ExternalProject_Add"

I have following CMakeLists.txt file: cmake_minimum_required (VERSION 3.2 FATAL_ERROR) project (utils VERSION 1.0.0 LANGUAGES CXX) ExternalProject_Add(json-c GIT_REPOSITORY "https://github.com/json-c/json-c.git" UPDATE_COMMAND git pull…
user3237732
  • 1,976
  • 2
  • 21
  • 28
25
votes
4 answers

How to configure ExternalProject during main project configuration?

The CMake's ExternalProject allows to define how to an external project is going to be downloaded, configured, built and installed. All whose steps are going to be performed at the build time. I would like to perform the configuration step of an…
Paweł Bylica
  • 3,780
  • 1
  • 31
  • 44
16
votes
1 answer

What is INSTALL_DIR useful for in ExternalProject_Add command?

I don't understand the usage of INSTALL_DIR in ExternalProject_Add command. I try to use it but it does not seem to work. Here is an example of a CMakeLists.txt, using Eigen library which compiles quickly: cmake_minimum_required (VERSION…
Aleph
  • 1,343
  • 1
  • 12
  • 27
13
votes
1 answer

CMake ExternalProject_Add() - Building with customized CMakeLists.txt

I am building lua as an external project and I want to use my own CMakeLists.txt instead of the bundled Makefile. This is what I have in my main CMakeLists.txt: include(ExternalProject) set(lua_RELEASE 5.1.4) ExternalProject_Add( …
Oskar N.
  • 8,427
  • 2
  • 23
  • 21
12
votes
1 answer

cmake external projects command seems to ignore INSTALL_DIR

First off, I'm relatively new to cmake. I'm trying to use cmake to build a project with a single external dependency. I specify the INSTALL_DIR for the external project to be CMAKE_INSTALL_PREFIX, so it installs to the same place as the parent…
orodbhen
  • 2,644
  • 3
  • 20
  • 29
10
votes
1 answer

How to request a password for GIT_REPOSITORY using HTTPS URL

The URL understood by the git command can be in the format HTTPS or SSH. In CMake, using ExternalProject_Add for the specified GIT_REPOSITORY any URL understood by the git command may be used. Using HTTPS user credentials must be given in order to…
linuxUser123
  • 529
  • 3
  • 17
9
votes
1 answer

How to build cmake ExternalProject while configurating main one?

It can be a pain to refrence ExternalProjects when their install targets are messed up. So one may want to build and install ExternalProjects once before generating main project files for given project. Is it possible with CMake and how to do it?
DuckQueen
  • 772
  • 10
  • 62
  • 134
8
votes
1 answer

Set WORKING_DIRECTORY for ExternalProject_Add CONFIGURE_COMMAND

I'm trying to add an Automake project as an external project. The Automake configure script (usually run with ./configure) contains a relative path to a resource file. The file is found when I run configure manually, because my working directory is…
the_storyteller
  • 2,335
  • 1
  • 26
  • 37
8
votes
1 answer

Avoiding extra ExternalProject downloads

Let's say I have the following project setup with these dependencies: MainProject ├─ Dependency_1 │ └─ Dependency_2 └─ Dependency_2 These dependencies are handled in MainProject and Dependency_1 with ExternalProject. The problem is Dependency_2…
syb0rg
  • 8,057
  • 9
  • 41
  • 81
8
votes
1 answer

Installing an ExternalProject with CMake

I have the following code in one of my CMakeLists.txt: FIND_PACKAGE(sphinxbase) if (${SPHINXBASE_FOUND}) INCLUDE_DIRECTORIES(${SPHINXBASE_INCLUDE_DIR}/sphinxbase/) else () ExternalProject_Add( sphinxbase GIT_REPOSITORY …
syb0rg
  • 8,057
  • 9
  • 41
  • 81
7
votes
0 answers

CMake ExternalProject_Add ignore dependency's cmake warnings

One of the libraries I'm using is giving a cmake warning for the developers of it. I'm trying to suppress that warning in my ExternalProject_Add with -Wno-dev I tried setting it at: CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS This is…
ZeroPhase
  • 649
  • 4
  • 21
1
2 3 4 5 6 7 8