lundi 5 octobre 2015

Avoid CMake subcommand after ExternalProject is already installed

The project that I'm working on has a dependency on Eigen3. Previously, I was just having the end user specify the path to the Eigen3 headers manually during the configure step, but this has become cumbersome, and I'd like to take some of that responsibility off the user. I've set up a CMake External project to grab the HG repository via:

message( STATUS "Looking for Eigen3 ")
find_package(Eigen3)
if(NOT EIGEN3_FOUND)
  message( STATUS "Looking for Eigen3 - found!")
else()
  find_file(EIGEN3_IN_DEPS Eigen/Core ${PROJECT_BINARY_DIR}/deps/include/eigen3)
  if(NOT EIGEN3_IN_DEPS)
    message( STATUS "Looking for Eigen3 - not found!")
    ExternalProject_Add(eigen3
      PREFIX "${PROJECT_BINARY_DIR}/deps/eigen3"
      HG_REPOSITORY "http://ift.tt/1ox4m0d"
      CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/deps"
      "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
      "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
      UPDATE_DISCONNECTED 1)
  endif()
endif()

The problem I'm having is that now my CMake generated Makefile always runs the Eigen3 configure step every time I recompile my problem. Granted, this is not generally a problem for the end user, only developers. I'd rather not have to wait for this configure every time I recompile, is there a way to specify that the only time I should try to configure Eigen3 from the HG Repo is the initial build?

Aucun commentaire:

Enregistrer un commentaire