R zu
R zu

Reputation: 2064

Use CMake's ExternalProject_Add to clone git repository without building it

I want CMake to git clone a header only library without building it. I tried:

ExternalProject_Add(eigen
        GIT_REPOSITORY https://github.com/eigenteam/eigen-git-mirror.git
        CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
        GIT_SHALLOW 1)

But that builds the external project. How to git clone without building?

Upvotes: 2

Views: 4515

Answers (1)

compor
compor

Reputation: 2329

According to the documentation, you need to:

  1. Set the CONFIGURE_COMMAND parameter as an empty string (i.e. "") in order to stop the CMake configuration (the project is assumed to be CMake-base by default).
  2. Set the BUILD_COMMAND parameter as an empty string to disable the build step.
  3. Set the INSTALL_COMMAND parameter as an empty string to force the install step to do nothing.

However, if there are no complicated conditions for the inclusion of Eigen, i.e. it is always a required component for your project, you might need to consider the use of git submodules (this might be a better approach even if Eigen is not a mandatory requirement).

Upvotes: 3

Related Questions