Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • danc/MicroCART
  • snawerdt/MicroCART_17-18
  • bbartels/MicroCART_17-18
  • jonahu/MicroCART
4 results
Select Git revision
Show changes
Showing
with 0 additions and 1564 deletions
/**
* \file Findcppcheck.cpp
* \brief Dummy C++ source file used by CMake module Findcppcheck.cmake
*
* \author
* Ryan Pavlik, 2009-2010
* <rpavlik@iastate.edu>
* http://academic.cleardefinition.com/
*
*/
int main(int argc, char* argv[]) {
return 0;
}
# - Find quatlib
# Find the quatlib headers and libraries.
#
# QUATLIB_INCLUDE_DIRS - where to find quat.h
# QUATLIB_LIBRARIES - List of libraries when using quatlib.
# QUATLIB_FOUND - True if quatlib found.
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(TARGET quat)
# Look for the header file.
find_path(QUATLIB_INCLUDE_DIR NAMES quat.h
PATHS ${quatlib_SOURCE_DIR})
set(QUATLIB_LIBRARY "quat")
else()
set(QUATLIB_ROOT_DIR
"${QUATLIB_ROOT_DIR}"
CACHE
PATH
"Root directory to search for quatlib")
if(DEFINED VRPN_ROOT_DIR AND NOT QUATLIB_ROOT_DIR)
set(QUATLIB_ROOT_DIR "${VRPN_ROOT_DIR}")
mark_as_advanced(QUATLIB_ROOT_DIR)
endif()
if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8")
set(_libsuffixes lib64 lib)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _progfiles)
else()
set(_libsuffixes lib)
if(NOT "$ENV{ProgramFiles(x86)}" STREQUAL "")
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _progfiles)
else()
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles)
endif()
endif()
# Look for the header file.
find_path(QUATLIB_INCLUDE_DIR
NAMES
quat.h
HINTS
"${QUATLIB_ROOT_DIR}"
PATH_SUFFIXES
include
PATHS
"${_progfiles}/VRPN"
"${_progfiles}/quatlib"
C:/usr/local
/usr/local)
# Look for the library.
find_library(QUATLIB_LIBRARY
NAMES
quat.lib
libquat.a
HINTS
"${QUATLIB_ROOT_DIR}"
PATH_SUFFIXES
${_libsuffixes}
PATHS
"${_progfiles}/VRPN"
"${_progfiles}/quatlib"
C:/usr/local
/usr/local)
endif()
# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(quatlib
DEFAULT_MSG
QUATLIB_LIBRARY
QUATLIB_INCLUDE_DIR)
if(QUATLIB_FOUND)
set(QUATLIB_LIBRARIES ${QUATLIB_LIBRARY})
if(NOT WIN32)
list(APPEND QUATLIB_LIBRARIES m)
endif()
set(QUATLIB_INCLUDE_DIRS ${QUATLIB_INCLUDE_DIR})
mark_as_advanced(QUATLIB_ROOT_DIR)
else()
set(QUATLIB_LIBRARIES)
set(QUATLIB_INCLUDE_DIRS)
endif()
mark_as_advanced(QUATLIB_LIBRARY QUATLIB_INCLUDE_DIR)
# - Utility function to return a human-useful-only string ID'ing the compiler
#
# get_compiler_info_string(<resultvar>)
#
# and some helper functions:
# get_gcc_version(<resultvar>)
# get_vs_short_version_string(<generator> <resultvar>)
#
# You might consider using it when setting up CTest options, for example:
# include(GetCompilerInfoString)
# get_compiler_info_string(COMPILERID)
# set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILERID}")
#
# Requires these CMake modules:
# no additional modules required
#
# Original Author:
# 2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Some functions based on cmake-2.8.0 modules FindBoost.cmake and CTest.cmake
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
# Copyright 2007 Wengo
# Copyright 2007 Mike Jackson
# Copyright 2008 Andreas Pakulat <apaku@gmx.de>
# Copyright 2008-2009 Philip Lowman <philip@yhbt.com>
# Copyright 2010 Iowa State University (Ryan Pavlik <abiryan@ryand.net>)
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "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 THE COPYRIGHT
# HOLDER OR 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.
#=============================================================================
if(__get_compiler_info_string)
return()
endif()
set(__get_compiler_info_string YES)
function(get_compiler_info_string _var)
set(_out)
if(CTEST_CMAKE_GENERATOR AND NOT CMAKE_GENERATOR)
# We're running in CTest - use that generator.
set(CMAKE_GENERATOR ${CTEST_CMAKE_GENERATOR})
endif()
if(NOT CMAKE_CXX_COMPILER)
# Also for use in CTest scripts
include(CMakeDetermineCXXCompiler)
endif()
if(MSVC)
# Parse version for Visual Studio
get_vs_short_version_string("${CMAKE_GENERATOR}" _verstring)
if(${CMAKE_GENERATOR} MATCHES "Win64")
set(_verstring "${_verstring}win64")
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX)
# Parse version for GCC
get_gcc_version(_gccver)
set(_verstring "gcc${_gccver}")
else()
# Some other compiler we don't handle in more detail yet.
string(REGEX REPLACE " " "_" _verstring "${CMAKE_GENERATOR}")
set(_verstring "${CMAKE_CXX_COMPILER_ID}:generator:${_verstring}")
endif()
# Return _verstring
set(${_var} "${_verstring}" PARENT_SCOPE)
endfunction()
## Based on a function in FindBoost.cmake from CMake 2.8.0
#-------------------------------------------------------------------------------
#
# Runs compiler with "-dumpversion" and parses major/minor
# version with a regex.
#
function(get_gcc_version _var)
exec_program(${CMAKE_CXX_COMPILER}
ARGS
${CMAKE_CXX_COMPILER_ARG1}
-dumpversion
OUTPUT_VARIABLE
_compilerinfo_COMPILER_VERSION)
string(REGEX
MATCH
"([.0-9]+)"
"\\1"
_compilerinfo_COMPILER_VERSION
"${_compilerinfo_COMPILER_VERSION}")
set(${_var} ${_compilerinfo_COMPILER_VERSION} PARENT_SCOPE)
endfunction()
## Based on a function in CTest.cmake from CMake 2.8.0
#-------------------------------------------------------------------------------
#
# function to turn generator name into a version string
# like vs7 vs71 vs8 vs9
#
function(get_vs_short_version_string _generator _var)
set(_ver_string)
if("${_generator}" MATCHES "Visual Studio")
string(REGEX
REPLACE
"Visual Studio ([0-9][0-9]?)($|.*)"
"\\1"
_vsver
"${_generator}")
if("${_generator}" MATCHES "Visual Studio 7 .NET 2003")
# handle the weird one
set(_ver_string "vs71")
else()
set(_ver_string "vs${_vsver}")
endif()
elseif(MSVC)
if(MSVC71)
set(_ver_string "vs71")
else()
foreach(_ver 6 7 8 9 10)
if(MSVC${_ver}0)
set(_ver_string "vs${_ver}")
break()
endif()
endforeach()
endif()
endif()
if(_ver_string)
set(${_var} ${_ver_string} PARENT_SCOPE)
endif()
endfunction()
# - Script to get the value of a preprocessor definition that is a string,
# after including the given files
# Requires that the associated source file be present: GetDefineString.cpp.in.
#
# get_define_string(NAME <define_name> [INCLUDES <files>] RESULT <variable>
# [FLAGS <compile-flags>]
# [INCLUDE_DIRS <include-dirs>]
# [DEFINES] <-Ddefinitions>)
# Original Author:
# 2014 Ryan Pavlik <ryan@sensics.com> <abiryan@ryand.net>
#
# Copyright Sensics, Inc. 2014.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
get_filename_component(_getdefinestring_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH)
function(get_define_string)
include(CMakeParseArguments)
cmake_parse_arguments(_gds "" "NAME;RESULT" "INCLUDES;FLAGS;INCLUDE_DIRS;DEFINES" ${ARGN})
if(NOT _gds_NAME)
message(FATAL_ERROR "Must pass NAME to get_define_string!")
endif()
if(NOT _gds_RESULT)
message(FATAL_ERROR "Must pass RESULT to get_define_string!")
endif()
if(NOT DEFINED "${_gds_RESULT}_CHECKED" OR (NOT "${${_gds_RESULT}_CHECKED}" STREQUAL "${ARGN}"))
set(${_gds_RESULT}_CHECKED "${ARGN}" CACHE INTERNAL "" FORCE)
set(GET_DEFINE_STRING_NAME ${_gds_NAME})
set(_INCLUDES)
if(_gds_INCLUDE_DIRS)
set(_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${_gds_INCLUDE_DIRS}")
endif()
set(GET_DEFINE_STRING_INCLUDES)
foreach(_file ${_gds_INCLUDES})
set(GET_DEFINE_STRING_INCLUDES "${GET_DEFINE_STRING_INCLUDES}#include <${_file}>\n")
endforeach()
set(_src "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/GetDefineString${_gds_RESULT}.cpp")
set(_out "${CMAKE_CURRENT_BINARY_DIR}/GetDefineString${_gds_RESULT}.out")
configure_file("${_getdefinestring_moddir}/GetDefineString.cpp.in" "${_src}")
try_compile(_result "${CMAKE_CURRENT_BINARY_DIR}" SOURCES "${_src}"
CMAKE_FLAGS ${_INCLUDES}
COMPILE_DEFINITIONS ${_gds_DEFINES}
OUTPUT_VARIABLE OUTPUT
COPY_FILE "${_out}")
if(_result)
file(STRINGS "${_out}" _result_string REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
if("${_result_string}" MATCHES "INFO:define\\[([^]\"]*)\\]")
set(${_gds_RESULT}_CACHED "${CMAKE_MATCH_1}" CACHE INTERNAL "" FORCE)
endif()
else()
set(${_gds_RESULT}_CACHED NOTFOUND)
endif()
endif()
set(${_gds_RESULT} ${${_gds_RESULT}_CACHED} PARENT_SCOPE)
endfunction()
\ No newline at end of file
@GET_DEFINE_STRING_INCLUDES@
char const * info = "INFO" ":" "define[" @GET_DEFINE_STRING_NAME@ "]";
int main(int argc, char * argv[]) {
int require = 0;
require += info[argc];
(void)argv;
return require;
}
\ No newline at end of file
# - Returns a list of the parent directories of all files passed
#
# get_directory_list(<listvar> <file path> [<additional file paths>...])
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_directory_list)
return()
endif()
set(__get_directory_list YES)
function(get_directory_list _var)
# combine variable's current value with additional list items
set(_in ${ARGN})
if(_in)
# Initial list cleaning
list(REMOVE_DUPLICATES _in)
# Grab the absolute path of each actual directory
set(_out)
foreach(_file ${_in})
get_filename_component(_dir "${_file}" PATH)
if(IS_DIRECTORY "${_dir}")
get_filename_component(_dir "${_dir}" ABSOLUTE)
file(TO_CMAKE_PATH "${_dir}" _dir)
list(APPEND _out "${_dir}")
endif()
endforeach()
if(_out)
# Clean up the output list now
list(REMOVE_DUPLICATES _out)
endif()
# return _out
set(${_var} "${_out}" PARENT_SCOPE)
endif()
endfunction()
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
set(HEAD_HASH "${HEAD_REF}")
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
# - Combine lists of prefixes and suffixes in all combinations
#
# list_combinations(var PREFIXES listitems... SUFFIXES listitems...) -
# where var is the name of your desired output variable and PREFIXES
# and SUFFIXES are special arguments that indicate the start of your
# list of prefixes or suffixes respectively.
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__list_combinations)
return()
endif()
set(__list_combinations YES)
function(list_combinations var)
# Parse arguments
set(_prefixes)
set(_suffixes)
set(_nowhere)
set(_curdest _nowhere)
foreach(_element ${ARGN})
if("${_element}" STREQUAL "PREFIXES")
set(_curdest _prefixes)
elseif("${_element}" STREQUAL "SUFFIXES")
set(_curdest _suffixes)
else()
list(APPEND ${_curdest} "${_element}")
endif()
endforeach()
if(_nowhere)
message(STATUS "_prefixes ${_prefixes}")
message(STATUS "_prefixes ${_suffixes}")
message(STATUS "_prefixes ${_nowhere}")
message(FATAL_ERROR
"Syntax error in use of ${CMAKE_CURRENT_LIST_FILE}")
endif()
foreach(_prefix ${_prefixes})
foreach(_suffix ${_suffixes})
list(APPEND _out "${_prefix}${_suffix}")
endforeach()
endforeach()
set(${var} "${_out}" PARENT_SCOPE)
endfunction()
# - Compile with multiple processes on MSVC
#
# include(MSVCMultipleProcessCompile)
#
# Requires these CMake modules:
# ListCombinations.cmake
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(MSVC AND NOT "${MSVC_VERSION}" LESS 1400)
# Only available in VS 2005 and newer
string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC)
include(ListCombinations)
list_combinations(_varnames
PREFIXES
CMAKE_C_FLAGS_
CMAKE_CXX_FLAGS_
SUFFIXES
${_conftypesUC})
foreach(_var ${_varnames})
set(${_var} "${${_var}} /MP")
endforeach()
endif()
# - Add an option that depends on one or more variables being true.
#
# option_requires(<option_name> <description> <variable_name> [<variable_name>...])
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
function(option_requires name desc)
set(args ${ARGN})
set(OFF_BY_DEFAULT false)
list(FIND args "OFF_BY_DEFAULT" _off_found)
if(NOT _off_found EQUAL -1)
list(REMOVE_AT args ${_off_found})
set(OFF_BY_DEFAULT true)
endif()
set(found)
set(missing)
foreach(var ${args})
if(${var})
list(APPEND found ${var})
else()
list(APPEND missing ${var})
endif()
endforeach()
if(NOT missing)
set(OK TRUE)
else()
set(OK FALSE)
endif()
set(default ${OK})
if(OFF_BY_DEFAULT)
set(default OFF)
endif()
option(${name} "${desc}" ${default})
if(${name} AND (NOT OK))
message(FATAL_ERROR
"${name} enabled but these dependencies were not valid: ${missing}")
endif()
endfunction()
# - For each given prefix in a list, glob using the prefix+pattern
#
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__prefix_list_glob)
return()
endif()
set(__prefix_list_glob YES)
function(prefix_list_glob var pattern)
set(_out)
set(_result)
foreach(prefix ${ARGN})
file(GLOB _globbed ${prefix}${pattern})
if(_globbed)
list(SORT _globbed)
list(REVERSE _globbed)
list(APPEND _out ${_globbed})
endif()
endforeach()
foreach(_name ${_out})
get_filename_component(_name "${_name}" ABSOLUTE)
list(APPEND _result "${_name}")
endforeach()
set(${var} "${_result}" PARENT_SCOPE)
endfunction()
# - Find bit-appropriate program files directories matching a given pattern
#
# Requires these CMake modules:
# CleanDirectoryList
# PrefixListGlob
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
include(PrefixListGlob)
include(CleanDirectoryList)
if(__program_files_glob)
return()
endif()
set(__program_files_glob YES)
function(program_files_glob var pattern)
# caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch
# of the running executable which, since CMake is 32-bit on Windows as
# I write this, will always be = $ENV{ProgramFiles(x86)}.
# Thus, we only use this environment variable if we are on a 32 machine
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES)
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432)
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
# 64-bit build on win64
set(_PROGFILESDIRS "${_PROG_FILES_W6432}")
else()
if(_PROG_FILES_W6432)
# 32-bit build on win64
set(_PROGFILESDIRS "${_PROG_FILES_X86}")
else()
# 32-bit build on win32
set(_PROGFILESDIRS "${_PROG_FILES}")
endif()
endif()
prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS})
clean_directory_list(_prefixed)
set(${var} ${_prefixed} PARENT_SCOPE)
endfunction()
function(program_files_fallback_glob var pattern)
# caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch
# of the running executable which, since CMake is 32-bit on Windows as
# I write this, will always be = $ENV{ProgramFiles(x86)}.
# Thus, we only use this environment variable if we are on a 32 machine
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES)
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432)
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
# 64-bit build on win64
# look in the "32 bit" (c:\program files (x86)\) directory as a
# fallback in case of weird/poorly written installers, like those
# that put both 64- and 32-bit libs in the same program files directory
set(_PROGFILESDIRS "${_PROG_FILES_W6432}" "${_PROG_FILES_X86}")
else()
if(_PROG_FILES_W6432)
# 32-bit build on win64
# look in the "64 bit" (c:\program files\) directory as a fallback
# in case of old/weird/poorly written installers
set(_PROGFILESDIRS "${_PROG_FILES_X86}" "${_PROG_FILES_W6432}")
else()
# 32-bit build on win32
set(_PROGFILESDIRS "${_PROG_FILES}")
endif()
endif()
prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS})
clean_directory_list(_prefixed)
set(${var} ${_prefixed} PARENT_SCOPE)
endfunction()
# - Set a developer-chosen default build type
#
# Requires these CMake modules:
# no additional modules required
#
# Original Author:
# 2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
if(__set_default_build_type)
return()
endif()
set(__set_default_build_type YES)
function(set_default_build_type _type)
#if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE)
if("${CMAKE_GENERATOR}" MATCHES "Makefiles" AND NOT CMAKE_BUILD_TYPE)
if(NOT __DEFAULT_BUILD_TYPE_SET)
set(CMAKE_BUILD_TYPE "${_type}" CACHE STRING "" FORCE)
set(__DEFAULT_BUILD_TYPE_SET YES CACHE INTERNAL "")
endif()
endif()
endfunction()
# - Do a version-dependent check and auto-include backported modules dirs
#
# Name your module directories cmake-*-modules where * is the full
# (maj.min.patch) version number that they came from. You can use
# subdirectories within those directories, if you like - all directories
# inside of a cmake-*-modules dir for a newer version of CMake that what
# we're running, that contain one or more .cmake files, will be appended
# to the CMAKE_MODULE_PATH.
#
# When backporting modules, be sure to test them and follow copyright
# instructions (usually updating copyright notices)
#
# Requires these CMake modules:
# CleanDirectoryList
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(NOT CMAKE_VERSION) # defined in >=2.6.3
set(_cmver
"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
else()
set(_cmver "${CMAKE_VERSION}")
endif()
include(CleanDirectoryList)
# No debugging output please
set(USE_BACKPORTED_MODULES_VERBOSE NO)
get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH)
file(GLOB _globbed "${_moddir}/cmake-*-modules")
if(USE_BACKPORTED_MODULES_VERBOSE)
message(STATUS
"UseBackportedModules: Detected use of CMake version ${_cmver}")
message(STATUS "Checking these base directories: ${_globbed}")
endif()
foreach(_dir ${_globbed})
string(REGEX
MATCH
"cmake-[0-9].[0-9].[0-9]-modules"
_dirname
"${_dir}")
string(REGEX
REPLACE
"cmake-([0-9].[0-9].[0-9])-modules"
"\\1"
_ver
"${_dirname}")
string(REGEX
REPLACE
"cmake-([0-9]).([0-9]).([0-9])-modules"
"\\1_\\2_\\3"
_ver_clean
"${_dirname}")
if(USE_BACKPORTED_MODULES_VERBOSE)
message(STATUS "${_dir}: ${_ver} ${_ver_clean}")
endif()
if("${_cmver}" VERSION_LESS "${_ver}")
list(APPEND _upgradever "${_ver_clean}")
file(GLOB_RECURSE _modules "${_dir}/*.cmake")
foreach(_mod ${_modules})
get_filename_component(_path "${_mod}" PATH)
list(APPEND _paths_${_ver_clean} "${_path}")
endforeach()
endif()
endforeach()
# Autoinclude files from oldest version to newest version
if(_upgradever)
set(_save_cmake_module_path ${CMAKE_MODULE_PATH})
list(REMOVE_DUPLICATES _upgradever)
list(SORT _upgradever)
foreach(_ver_clean ${_upgradever})
clean_directory_list(_paths_${_ver_clean})
foreach(_dir ${_paths_${_ver_clean}})
set(CMAKE_MODULE_PATH ${_dir} ${_save_cmake_module_path})
include("${_dir}/autoinclude.cmake" OPTIONAL RESULT_VARIABLE _result)
if(USE_BACKPORTED_MODULES_VERBOSE)
message(STATUS "${_dir} - Autoincluded: ${_result}")
endif()
endforeach()
endforeach()
set(CMAKE_MODULE_PATH ${_save_cmake_module_path})
endif()
# Add the module path from newest version to oldest version
set(_added_module_path)
if(_upgradever)
list(REVERSE _upgradever)
foreach(_ver_clean ${_upgradever})
list(APPEND _added_module_path ${_paths_${_ver_clean}})
endforeach()
endif()
list(APPEND CMAKE_MODULE_PATH ${_added_module_path})
if(USE_BACKPORTED_MODULES_VERBOSE)
message(STATUS "New module path: ${CMAKE_MODULE_PATH}")
endif()
# - Print a developer warning, using author_warning if we have cmake 2.8
#
# warning_dev("your desired message")
#
# Original Author:
# 2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
function(warning_dev _yourmsg)
if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0")
# CMake version <2.8.0
message(STATUS
"The following is a developer warning - end users may ignore it")
message(STATUS "Dev Warning: ${_yourmsg}")
else()
message(AUTHOR_WARNING "${_yourmsg}")
endif()
endfunction()
# select_library_configurations( basename )
#
# This macro takes a library base name as an argument, and will choose good
# values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and
# basename_LIBRARY_RELEASE depending on what has been found and set. If only
# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG,
# and basename_LIBRARY_RELEASE will be set to the release value. If only
# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
#
# If the generator supports configuration types, then basename_LIBRARY and
# basename_LIBRARIES will be set with debug and optimized flags specifying the
# library to be used for the given configuration. If no build type has been set
# or the generator in use does not support configuration types, then
# basename_LIBRARY and basename_LIBRARIES will take only the release values.
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
# Copyright 2005-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see below.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "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 THE COPYRIGHT
# HOLDER OR 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.
#=============================================================================
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
# Dicharry <wdicharry@stellarscience.com>.
# Utility macro to check if one variable exists while another doesn't, and set
# one that doesn't exist to the one that exists.
macro( _set_library_name basename GOOD BAD )
if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} )
set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} )
set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} )
endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
endmacro( _set_library_name )
macro( select_library_configurations basename )
# if only the release version was found, set the debug to be the release
# version.
_set_library_name( ${basename} RELEASE DEBUG )
# if only the debug version was found, set the release value to be the
# debug value.
_set_library_name( ${basename} DEBUG RELEASE )
if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
# if the generator supports configuration types or CMAKE_BUILD_TYPE
# is set, then set optimized and debug options.
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
set( ${basename}_LIBRARY
optimized ${${basename}_LIBRARY_RELEASE}
debug ${${basename}_LIBRARY_DEBUG} )
set( ${basename}_LIBRARIES
optimized ${${basename}_LIBRARY_RELEASE}
debug ${${basename}_LIBRARY_DEBUG} )
else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
# If there are no configuration types or build type, just use
# the release version
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} )
endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
"The ${basename} library" )
if( ${basename}_LIBRARY )
set( ${basename}_FOUND TRUE )
endif( ${basename}_LIBRARY )
mark_as_advanced( ${basename}_LIBRARY
${basename}_LIBRARY_RELEASE
${basename}_LIBRARY_DEBUG
)
endmacro( select_library_configurations )
# - Configure a project for testing with CTest/CDash
# Include this module in the top CMakeLists.txt file of a project to
# enable testing with CTest and dashboard submissions to CDash:
# project(MyProject)
# ...
# include(CTest)
# The module automatically creates a BUILD_TESTING option that selects
# whether to enable testing support (ON by default). After including
# the module, use code like
# if(BUILD_TESTING)
# # ... CMake code to create tests ...
# endif()
# to creating tests when testing is enabled.
#
# To enable submissions to a CDash server, create a CTestConfig.cmake
# file at the top of the project with content such as
# set(CTEST_PROJECT_NAME "MyProject")
# set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
# set(CTEST_DROP_METHOD "http")
# set(CTEST_DROP_SITE "my.cdash.org")
# set(CTEST_DROP_LOCATION "/submit.php?project=MyProject")
# set(CTEST_DROP_SITE_CDASH TRUE)
# (the CDash server can provide the file to a project administrator
# who configures 'MyProject').
# Settings in the config file are shared by both this CTest module and
# the CTest command-line tool's dashboard script mode (ctest -S).
#
# While building a project for submission to CDash, CTest scans the
# build output for errors and warnings and reports them with
# surrounding context from the build log. This generic approach works
# for all build tools, but does not give details about the command
# invocation that produced a given problem. One may get more detailed
# reports by adding
# set(CTEST_USE_LAUNCHERS 1)
# to the CTestConfig.cmake file. When this option is enabled, the
# CTest module tells CMake's Makefile generators to invoke every
# command in the generated build system through a CTest launcher
# program. (Currently the CTEST_USE_LAUNCHERS option is ignored on
# non-Makefile generators.) During a manual build each launcher
# transparently runs the command it wraps. During a CTest-driven
# build for submission to CDash each launcher reports detailed
# information when its command fails or warns.
# (Setting CTEST_USE_LAUNCHERS in CTestConfig.cmake is convenient, but
# also adds the launcher overhead even for manual builds. One may
# instead set it in a CTest dashboard script and add it to the CMake
# cache for the build tree.)
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see below.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "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 THE COPYRIGHT
# HOLDER OR 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.
#=============================================================================
option(BUILD_TESTING "Build the testing tree." ON)
# function to turn generator name into a version string
# like vs7 vs71 vs8 vs9
function(get_vs_version_string generator var)
string(REGEX
REPLACE
"Visual Studio ([0-9][0-9]?)($|.*)"
"\\1"
NUMBER
"${generator}")
if("${generator}" MATCHES "Visual Studio 7 .NET 2003")
set(ver_string "vs71")
else()
set(ver_string "vs${NUMBER}")
endif()
set(${var} ${ver_string} PARENT_SCOPE)
endfunction()
if(BUILD_TESTING)
# Setup some auxilary macros
macro(set_if_not_set var val)
if(NOT DEFINED "${var}")
set("${var}" "${val}")
endif()
endmacro()
macro(set_if_set var val)
if(NOT "${val}" MATCHES "^$")
set("${var}" "${val}")
endif()
endmacro()
macro(set_if_set_and_not_set var val)
if(NOT "${val}" MATCHES "^$")
set_if_not_set("${var}" "${val}")
endif()
endmacro()
# Make sure testing is enabled
enable_testing()
if(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
include("${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
set_if_set_and_not_set(NIGHTLY_START_TIME
"${CTEST_NIGHTLY_START_TIME}")
set_if_set_and_not_set(DROP_METHOD "${CTEST_DROP_METHOD}")
set_if_set_and_not_set(DROP_SITE "${CTEST_DROP_SITE}")
set_if_set_and_not_set(DROP_SITE_USER "${CTEST_DROP_SITE_USER}")
set_if_set_and_not_set(DROP_SITE_PASSWORD
"${CTEST_DROP_SITE_PASWORD}")
set_if_set_and_not_set(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}")
set_if_set_and_not_set(DROP_LOCATION "${CTEST_DROP_LOCATION}")
set_if_set_and_not_set(TRIGGER_SITE "${CTEST_TRIGGER_SITE}")
set_if_set_and_not_set(UPDATE_TYPE "${CTEST_UPDATE_TYPE}")
endif()
# the project can have a DartConfig.cmake file
if(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
include("${PROJECT_SOURCE_DIR}/DartConfig.cmake")
else()
# Dashboard is opened for submissions for a 24 hour period starting at
# the specified NIGHTLY_START_TIME. Time is specified in 24 hour format.
set_if_not_set(NIGHTLY_START_TIME "00:00:00 EDT")
set_if_not_set(DROP_METHOD "http")
set_if_not_set(COMPRESS_SUBMISSION ON)
endif()
set_if_not_set(NIGHTLY_START_TIME "00:00:00 EDT")
if(NOT UPDATE_TYPE)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
set(UPDATE_TYPE cvs)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
set(UPDATE_TYPE svn)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr")
set(UPDATE_TYPE bzr)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg")
set(UPDATE_TYPE hg)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
set(UPDATE_TYPE git)
endif()
endif()
if(NOT UPDATE_TYPE)
if(NOT __CTEST_UPDATE_TYPE_COMPLAINED)
set(__CTEST_UPDATE_TYPE_COMPLAINED
1
CACHE
INTERNAL
"Already complained about update type.")
message(STATUS
"CTest cannot determine repository type. Please set UPDATE_TYPE to cvs, svn, bzr, hg, or git. CTest update will not work.")
endif()
endif()
string(TOLOWER "${UPDATE_TYPE}" _update_type)
if("${_update_type}" STREQUAL "cvs")
find_program(CVSCOMMAND cvs)
set(CVS_UPDATE_OPTIONS
"-d -A -P"
CACHE
STRING
"Options passed to the cvs update command.")
set(UPDATE_COMMAND "${CVSCOMMAND}")
set(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "svn")
find_program(SVNCOMMAND svn)
set(UPDATE_COMMAND "${SVNCOMMAND}")
set(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "bzr")
find_program(BZRCOMMAND bzr)
set(UPDATE_COMMAND "${BZRCOMMAND}")
set(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "hg")
find_program(HGCOMMAND hg)
set(UPDATE_COMMAND "${HGCOMMAND}")
set(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "git")
find_program(GITCOMMAND git)
set(UPDATE_COMMAND "${GITCOMMAND}")
set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}")
endif()
set(DART_TESTING_TIMEOUT
1500
CACHE
STRING
"Maximum time allowed before CTest will kill the test.")
find_program(MEMORYCHECK_COMMAND
NAMES
purify
valgrind
boundscheck
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC
"Path to the memory checking command, used for memory error detection.")
find_program(SLURM_SBATCH_COMMAND
sbatch
DOC
"Path to the SLURM sbatch executable")
find_program(SLURM_SRUN_COMMAND
srun
DOC
"Path to the SLURM srun executable")
set(MEMORYCHECK_SUPPRESSIONS_FILE
""
CACHE
FILEPATH
"File that contains suppressions for the memory checker")
find_program(SCPCOMMAND
scp
DOC
"Path to scp command, used by CTest for submitting results to a Dart server")
find_program(COVERAGE_COMMAND
gcov
DOC
"Path to the coverage program that CTest uses for performing coverage inspection")
# set the site name
site_name(SITE)
# set the build name
if(NOT BUILDNAME)
set(DART_COMPILER "${CMAKE_CXX_COMPILER}")
if(NOT DART_COMPILER)
set(DART_COMPILER "${CMAKE_C_COMPILER}")
endif()
if(NOT DART_COMPILER)
set(DART_COMPILER "unknown")
endif()
if(WIN32)
set(DART_NAME_COMPONENT "NAME_WE")
else()
set(DART_NAME_COMPONENT "NAME")
endif()
if(NOT BUILD_NAME_SYSTEM_NAME)
set(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
endif()
if(WIN32)
set(BUILD_NAME_SYSTEM_NAME "Win32")
endif()
if(UNIX OR BORLAND)
get_filename_component(DART_CXX_NAME
"${CMAKE_CXX_COMPILER}"
${DART_NAME_COMPONENT})
else()
get_filename_component(DART_CXX_NAME
"${CMAKE_BUILD_TOOL}"
${DART_NAME_COMPONENT})
endif()
if(DART_CXX_NAME MATCHES "msdev")
set(DART_CXX_NAME "vs60")
endif()
if(DART_CXX_NAME MATCHES "devenv")
get_vs_version_string("${CMAKE_GENERATOR}" DART_CXX_NAME)
endif()
set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}")
endif()
# the build command
build_command(MAKECOMMAND CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}")
set(MAKECOMMAND
${MAKECOMMAND}
CACHE
STRING
"Command to build the project")
# the default build configuration the ctest build handler will use
# if there is no -C arg given to ctest:
set(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
if(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "")
set(DEFAULT_CTEST_CONFIGURATION_TYPE "Release")
endif()
if(NOT "${CMAKE_GENERATOR}" MATCHES "Make")
set(CTEST_USE_LAUNCHERS 0)
endif()
if(CTEST_USE_LAUNCHERS)
set(CTEST_LAUNCH_COMPILE
"\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OBJECT> --source <SOURCE> --language <LANGUAGE> --")
set(CTEST_LAUNCH_LINK
"\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <TARGET> --target-type <TARGET_TYPE> --language <LANGUAGE> --")
set(CTEST_LAUNCH_CUSTOM
"\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OUTPUT> --")
set_property(GLOBAL
PROPERTY
RULE_LAUNCH_COMPILE
"${CTEST_LAUNCH_COMPILE}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}")
set_property(GLOBAL
PROPERTY
RULE_LAUNCH_CUSTOM
"${CTEST_LAUNCH_CUSTOM}")
endif()
mark_as_advanced(COVERAGE_COMMAND
CVSCOMMAND
SVNCOMMAND
BZRCOMMAND
HGCOMMAND
GITCOMMAND
CVS_UPDATE_OPTIONS
SVN_UPDATE_OPTIONS
BZR_UPDATE_OPTIONS
HG_UPDATE_OPTIONS
GIT_UPDATE_OPTIONS
MAKECOMMAND
MEMORYCHECK_COMMAND
MEMORYCHECK_SUPPRESSIONS_FILE
PURIFYCOMMAND
SCPCOMMAND
SLURM_SBATCH_COMMAND
SLURM_SRUN_COMMAND
SITE)
if(NOT RUN_FROM_DART)
set(RUN_FROM_CTEST_OR_DART 1)
include(CTestTargets)
set(RUN_FROM_CTEST_OR_DART)
endif()
endif()
# This file is read by ctest in script mode (-S)
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2009 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see below.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "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 THE COPYRIGHT
# HOLDER OR 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.
#=============================================================================
# Determine the current system, so this information can be used
# in ctest scripts
include(CMakeDetermineSystem)
# Also load the system specific file, which sets up e.g. the search paths.
# This makes the FIND_XXX() calls work much better
include(CMakeSystemSpecificInformation)