Andrej Pavlovic
Andrej Pavlovic

Reputation: 384

How to get ExternalProject_Add to download library?

I put together a simple CMakeLists.txt file that has a single call to ExternalProject_Add, but the project is never downloaded. Do I need to add something more to the file?

cmake_minimum_required(VERSION 3.2)
include(ExternalProject)

# Download and install GoogleTest
ExternalProject_Add(
    gtest
    URL https://googletest.googlecode.com/files/gtest-1.7.0.zip
    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest
    # Disable install step
    BUILD_IN_SOURCE 1
    INSTALL_COMMAND ""
    BUILD_ALWAYS 1
)

Then I execute cmake -G "Visual Studio 12" ..

Upvotes: 2

Views: 3269

Answers (1)

Andrej Pavlovic
Andrej Pavlovic

Reputation: 384

It turns out that downloading of library happens when building the project (in Visual Studio), after generating it with cmake... So first run cmake, then build project.

Upvotes: 8

Related Questions