| 1 |
# |
| 2 |
# Licensed to the Apache Software Foundation (ASF) under one |
| 3 |
# or more contributor license agreements. See the NOTICE file |
| 4 |
# distributed with this work for additional information |
| 5 |
# regarding copyright ownership. The ASF licenses this file |
| 6 |
# to you under the Apache License, Version 2.0 (the |
| 7 |
# "License"); you may not use this file except in compliance |
| 8 |
# with the License. You may obtain a copy of the License at |
| 9 |
# |
| 10 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
# |
| 12 |
# Unless required by applicable law or agreed to in writing, |
| 13 |
# software distributed under the License is distributed on an |
| 14 |
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 |
# KIND, either express or implied. See the License for the |
| 16 |
# specific language governing permissions and limitations |
| 17 |
# under the License. |
| 18 |
# |
| 19 |
|
| 20 |
cmake_minimum_required(VERSION 2.8.12) |
| 21 |
|
| 22 |
project(ProtonExamples) |
| 23 |
include(CTest) |
| 24 |
include("tests/RuntimeCheck.cmake") |
| 25 |
|
| 26 |
# find example sub-directories that contain "CMakeLists.txt" or "testme" |
| 27 |
set(ex_dir "${CMAKE_SOURCE_DIR}/examples") |
| 28 |
file(GLOB subs ${ex_dir}/*) |
| 29 |
foreach(dir ${subs}) |
| 30 |
get_filename_component(ex "${dir}" NAME) |
| 31 |
if(EXISTS ${dir}/CMakeLists.txt) |
| 32 |
# Has CMakeLists.txt to define example tests. |
| 33 |
add_subdirectory(${dir}) |
| 34 |
elseif(EXISTS ${dir}/testme) |
| 35 |
# Has a "testme" script to run example tests. |
| 36 |
pn_add_test( |
| 37 |
UNWRAPPED |
| 38 |
NAME ${ex}-example-tests |
| 39 |
COMMAND ${dir}/testme |
| 40 |
WORKING_DIRECTORY ${dir}) |
| 41 |
endif() |
| 42 |
endforeach() |