# @HEADER # ************************************************************************ # # TriBITS: Tribal Build, Integrate, and Test System # Copyright 2013 Sandia Corporation # # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, # the U.S. Government retains certain rights in this software. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # 3. Neither the name of the Corporation nor the names of the # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # ************************************************************************ # @HEADER ############################################# # # TriBITS platform-independent test driver. # ############################################# message("") message("*******************************") message("*** TribitsCTestDriverCore ***") message("*******************************") message("") cmake_minimum_required(VERSION 3.23.0 FATAL_ERROR) set(THIS_CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}") # # Get the basic variables that define the project and the build # # # Set TRIBITS_PROJECT_ROOT # # We must locate the source code root directory before processing this # file. Once the root directory is located, we can make good guesses at other # properties, but this file contains code that is executed in a CTest -S # script that is always executed outside of the context of the project's CMake # build. # # We allow the environment variable TRIBITS_PROJECT_ROOT to locate the # root directory. If the variable doesn't exist, we fall back on the # default convention. #message("TRIBITS_PROJECT_ROOT (before env) = '${TRIBITS_PROJECT_ROOT}'") if (NOT TRIBITS_PROJECT_ROOT) set(TRIBITS_PROJECT_ROOT "$ENV{TRIBITS_PROJECT_ROOT}") endif() #message("TRIBITS_PROJECT_ROOT (after env) = '${TRIBITS_PROJECT_ROOT}'") if (NOT TRIBITS_PROJECT_ROOT) # Fall back on the default convention, in which this file is located at: # /cmake/tribits/ctest. get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) set(TRIBITS_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../..") endif() get_filename_component(TRIBITS_PROJECT_ROOT "${TRIBITS_PROJECT_ROOT}" ABSOLUTE) message("TRIBITS_PROJECT_ROOT = '${TRIBITS_PROJECT_ROOT}'") # # Read in PROJECT_NAME # # Assert that the ProjectName.cmake file exists. set(TRIBITS_PROJECT_NAME_INCLUDE "${TRIBITS_PROJECT_ROOT}/ProjectName.cmake") if(NOT EXISTS "${TRIBITS_PROJECT_NAME_INCLUDE}") message(FATAL_ERROR "Could not locate ProjectName.cmake.\n" " TRIBITS_PROJECT_ROOT = ${TRIBITS_PROJECT_ROOT}\n" " Set the TRIBITS_PROJECT_ROOT environment variable " "to point at the source root.") endif() # Include the ProjectName.cmake file and get PROJECT_NAME include(${TRIBITS_PROJECT_NAME_INCLUDE}) if(NOT PROJECT_NAME) message(FATAL_ERROR "The project name has not been set!" " It should be set in ${TRIBITS_PROJECT_ROOT}/ProjectName.cmake.") endif() message("PROJECT_NAME = ${PROJECT_NAME}") # # Set ${PROJECT_NAME}_TRIBITS_DIR # if (NOT "$ENV{${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") set(${PROJECT_NAME}_TRIBITS_DIR "$ENV{${PROJECT_NAME}_TRIBITS_DIR}") endif() if ("${${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") set(${PROJECT_NAME}_TRIBITS_DIR "${TRIBITS_PROJECT_ROOT}/cmake/tribits") endif() message("${PROJECT_NAME}_TRIBITS_DIR = ${${PROJECT_NAME}_TRIBITS_DIR}") # ToDo: If you are really going to allow setting a different # ${PROJECT_NAME}_TRIBITS_DIR from where this module lives, then you need to # split off the implementation of this module into a separate # TribitsCTestDriverCoreImpl.cmake module and then include that based on the # set ${PROJECT_NAME}_TRIBITS_DIR var. # # Set default for CTEST_SOURCE_DIRECTORY # if ("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") message("Set default for CTEST_SOURCE_DIRECTORY to TRIBITS_PROJECT_ROOT='TRIBITS_PROJECT_ROOT='${TRIBITS_PROJECT_ROOT}'") set(CTEST_SOURCE_DIRECTORY ${TRIBITS_PROJECT_ROOT}) endif() # # Set default for CTEST_BINARY_DIRECTORY # if ("${CTEST_BINARY_DIRECTORY}" STREQUAL "") message("Set default for CTEST_BINARY_DIRECTORY to $PWD/BUILD='$ENV{PWD}/BUILD'") set(CTEST_BINARY_DIRECTORY $ENV{PWD}/BUILD) endif() # # Set CMAKE_MODULE_PATH # set( CMAKE_MODULE_PATH "${TRIBITS_PROJECT_ROOT}" "${TRIBITS_PROJECT_ROOT}/cmake" "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" "${${PROJECT_NAME}_TRIBITS_DIR}/ci_support" "${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver" ) include(TribitsConstants) tribits_asesrt_minimum_cmake_version() include(TribitsCMakePolicies NO_POLICY_SCOPE) include(Split) include(PrintVar) include(MultilineSet) include(SetDefaultAndFromEnv) include(AssertDefined) include(AppendSet) include(AppendStringVar) include(TribitsGlobalMacros) include(TribitsStripCommentsFromCMakeCacheFile) # Need to include the project's version file to get some Git and CDash # settings specific to the given version tribits_project_read_version_file(${TRIBITS_PROJECT_ROOT}) include(TribitsFindPythonInterp) tribits_find_python() message("PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") ############################# ### Do some initial setup ### ############################# # Get the host type if(WIN32) set(HOST_TYPE $ENV{OS}) else() find_program(UNAME_EXE NAMES uname) execute_process( COMMAND ${UNAME_EXE} OUTPUT_VARIABLE HOST_TYPE OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() # Find git find_package(Git REQUIRED) # Find gitdist set(GITDIST_EXE "${${PROJECT_NAME}_TRIBITS_DIR}/python_utils/gitdist") # Get the host name site_name(CTEST_SITE_DEFAULT) # Get helper functions include(TribitsCTestDriverCoreHelpers) # @FUNCTION: tribits_ctest_driver() # # Universal platform-independent CTest/CDash driver function for CTest -S # scripts for TriBITS projects # # Usage (in ``