[llvm-dev] [cfe-dev] Fwd: Raising CMake minimum version to 3.4.3

Chuck Atkins via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 27 12:01:18 PDT 2016


> > Replicating ExternalProject would be a lot of work...
>

One approach commonly used with CMake modules that change frequently
upstream is for the project to keep a local copy and have a check in place
to use CMake's version if new enough.  For instance, in llvm's source tree:

cmake/modules/ExternalProject.cmake:
if(CMAKE_VERSION VERSION_LESS "3.5.1")

include(${PROJECT_SOURCE_DIR}/cmake/modules/newcmake/ExternalProject.cmake)
else()
  include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
endif()

cmake/modules/newcmake/ExternalProject.cmake - Copy of the
ExternalProject.cmake shipped with 3.5.1

Then in the top level CMakeLists.txt, just include(ExternalProject).  It
will first load the version-check sicne that's in the module path and then
load CMake's copy if new enough, otherwise llvm's copy.  This way you can
keep the minimum CMake version for the project at 3.4.3, but make sure that
your always using ExternaProject from at least 3.5.1.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160427/23f42670/attachment.html>


More information about the llvm-dev mailing list