Select Git revision
Testing.cmake
Testing.cmake 7.86 KiB
#------------------------------------------------------------------------------
# Project Phoenix
#
# Copyright (c) 2017-2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#------------------------------------------------------------------------------
# License
#
# Licensed under the 3-Clause BSD License (the "License");
# you may not use this file except in compliance with the License.
# See the file LICENSE for the full text.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#------------------------------------------------------------------------------
include(CTest)
enable_testing()
include(WarningLevels)
conan_or_find_package(catch REQUIRED)
conan_or_find_package(trompeloeil REQUIRED)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY ADDED_TESTS "")
function(CREATE_TEST_MAIN)
set(options)
set(oneValueArgs )
set(multiValueArgs SOURCES HEADERS INCLUDE_DIRECTORIES LIBRARIES )
cmake_parse_arguments(CREATE_TEST_MAIN_
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
add_library(test_main
${CREATE_TEST_MAIN__SOURCES}
${CREATE_TEST_MAIN__HEADERS}
)
target_include_directories(test_main
PUBLIC ${CREATE_TEST_MAIN__INCLUDE_DIRECTORIES}
)
target_link_libraries(test_main
${CREATE_TEST_MAIN__LIBRARIES}
)
endfunction()
function(ADD_TEST_CATCH)
set(options )
set(oneValueArgs NAME TEST_MAIN_SOURCE)
set(multiValueArgs
SOURCES HEADERS INCLUDE_DIRECTORIES LIBRARIES PATH_TO_ADD)
cmake_parse_arguments(ADD_TEST_CATCH_
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
TESTING__REMOVE_FILE_FROM_(
${ADD_TEST_CATCH__TEST_MAIN_SOURCE}
ADD_TEST_CATCH__SOURCES
)
foreach(TEST_SOURCE_FILE ${ADD_TEST_CATCH__SOURCES})
get_filename_component(TEST_NAME ${TEST_SOURCE_FILE} NAME_WE)
add_test_internal_(NAME ${TEST_NAME}