From f8c1682cf56b126e8df7764bd18d5ab62cf17fa0 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 5 Dec 2014 05:40:49 -0500 Subject: [PATCH] Assert TriBITS min CMake version in TriBITS itself Now that the minimum CMake version is 2.8.11, it seems that CMake now allows to to assert the minimum CMake version in an included file. Now we can take the assertion of the minimum CMake version out of the base TriBITS project CMakeLists.txt file. --- tribits/core/package_arch/TribitsProjectImpl.cmake | 6 ++++-- tribits/examples/TribitsExampleProject/CMakeLists.txt | 5 +---- tribits/examples/TribitsHelloWorld/CMakeLists.txt | 7 +++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tribits/core/package_arch/TribitsProjectImpl.cmake b/tribits/core/package_arch/TribitsProjectImpl.cmake index 64338d385..af1c8abdd 100644 --- a/tribits/core/package_arch/TribitsProjectImpl.cmake +++ b/tribits/core/package_arch/TribitsProjectImpl.cmake @@ -58,9 +58,11 @@ IF (${PROJECT_NAME}_VERBOSE_CONFIGURE) MESSAGE("CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'") ENDIF() -INCLUDE(TribitsIncludeDirectories) - INCLUDE(TribitsConstants) + +CMAKE_MINIMUM_REQUIRED(VERSION ${TRIBITS_CMAKE_MINIMUM_REQUIRED} FATAL_ERROR) + +INCLUDE(TribitsIncludeDirectories) INCLUDE(TribitsGlobalMacros) INCLUDE(TribitsConfigureCTestCustom) diff --git a/tribits/examples/TribitsExampleProject/CMakeLists.txt b/tribits/examples/TribitsExampleProject/CMakeLists.txt index eab7fc9ef..b1bfc0dae 100644 --- a/tribits/examples/TribitsExampleProject/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject/CMakeLists.txt @@ -16,7 +16,7 @@ SET(CMAKE_LEGACY_CYGWIN_WIN32 1 CACHE BOOL "" FORCE) # don't process this file. # -# Get PROJECT_NAME (must be in file for other parts of system to read) +# Get PROJECT_NAME (must be in a file for other parts of system to read) INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/ProjectName.cmake") # CMake requires that you declare the CMake project in the top-level file and @@ -32,9 +32,6 @@ SET(${PROJECT_NAME}_TRIBITS_DIR "TriBITS base directory (default assumes in TriBITS source tree)") INCLUDE("${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake") -# CMake requires this be in the top file and not in an include file :-( -CMAKE_MINIMUM_REQUIRED(VERSION ${TRIBITS_CMAKE_MINIMUM_REQUIRED}) - # Set default location for header-only TPL to make easy to configure out of # the TriBITS source tree. SET(HeaderOnlyTpl_INCLUDE_DIRS diff --git a/tribits/examples/TribitsHelloWorld/CMakeLists.txt b/tribits/examples/TribitsHelloWorld/CMakeLists.txt index a3a4ca0cd..b7da4f69c 100644 --- a/tribits/examples/TribitsHelloWorld/CMakeLists.txt +++ b/tribits/examples/TribitsHelloWorld/CMakeLists.txt @@ -12,11 +12,10 @@ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/ProjectName.cmake) PROJECT(${PROJECT_NAME} NONE) SET(${PROJECT_NAME}_TRIBITS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../.. - CACHE PATH "Path to TriBITS.") -INCLUDE("${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake") + CACHE PATH "TriBITS base directory (default assumes in TriBITS source tree).") -# CMake requires this be in the top file and not in an include file :-( -CMAKE_MINIMUM_REQUIRED(VERSION ${TRIBITS_CMAKE_MINIMUM_REQUIRED}) +# Include the TriBITS system +INCLUDE("${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake") # Disable MPI and Fortran SET(TPL_ENABLE_MPI OFF CACHE BOOL "" FORCE)