CMake ExternalProject_Add Git

user3841904 picture user3841904 · Feb 3, 2015 · Viewed 8k times · Source

I have a git-bare-repository on my desktop and I would like to clone it with CMake. My repository has this path C:\Users\demoUser\Desktop\learnGIT\prog. My CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 2.8)
project(Demo)
include(ExternalProject)

ExternalProject_Add(demo
  GIT_REPOSITORY C:/Users/demoUser/Desktop/learnGIT/prog
  GIT_TAG master
  UPDATE_COMMAND ""
  INSTALL_COMMAND ""
)

but in the generated folder prog-build is just wast. The generated folder structure doesn't include any of my files from the repository.

Does somebody has an idea?

Answer

Oleg picture Oleg · Oct 18, 2017
  1. You have to have a target in your project that depends on external project

    add_dependencies(TargetName ExternalProjectName)
    
  2. The git clone happens on TargetName build (not on CMake reload)