Skip to content

Commit 18b1577

Browse files
committed
Add simple CI project inclusion
1 parent 81d8ff8 commit 18b1577

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

openorienteering-ci.cmake

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This file is part of OpenOrienteering.
2+
3+
# Copyright 2019 Kai Pastor
4+
#
5+
# Redistribution and use is allowed according to the terms of the BSD license:
6+
#
7+
# Redistribution and use in source and binary forms, with or without
8+
# modification, are permitted provided that the following conditions
9+
# are met:
10+
#
11+
# 1. Redistributions of source code must retain the copyright
12+
# notice, this list of conditions and the following disclaimer.
13+
# 2. Redistributions in binary form must reproduce the copyright
14+
# notice, this list of conditions and the following disclaimer in the
15+
# documentation and/or other materials provided with the distribution.
16+
# 3. The name of the author may not be used to endorse or promote products
17+
# derived from this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22+
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24+
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28+
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
30+
31+
# Import the CI script for the named OpenOrientering project.
32+
# This function sets up the ${project}_CI_SOURCE_DIR cache variable which
33+
# defaults to a corresponding sibling directory of the Superbuild, and
34+
# includes the CI cmake script from this directory if it is found.
35+
36+
function(OPENORIENTEERING_CI_ADD project)
37+
string(TOLOWER "${project}" project_lower)
38+
get_filename_component(base_dir "${CMAKE_CURRENT_LIST_DIR}" PATH)
39+
set(${project}_CI_SOURCE_DIR "${base_dir}/${project_lower}" CACHE STRING
40+
"The OpenOrienteering ${project} source directory"
41+
)
42+
set(${project}_CI_LIST_FILE
43+
"${${project}_CI_SOURCE_DIR}/ci/openorienteering-${project_lower}-ci.cmake"
44+
)
45+
if(EXISTS "${${project}_CI_LIST_FILE}")
46+
include("${${project}_CI_LIST_FILE}")
47+
endif()
48+
endfunction()
49+
50+
51+
# By editing the OPENORIENTEERING_CI_PROJECTS cache variable, it is possible
52+
# to name additional (new) CI projects which follow the project files layout
53+
# of the existing projects.
54+
list(APPEND OPENORIENTEERING_CI_PROJECTS
55+
"CupCalculator"
56+
"Mapper"
57+
)
58+
list(REMOVE_DUPLICATES OPENORIENTEERING_CI_PROJECTS)
59+
set(OPENORIENTEERING_CI_PROJECTS "${OPENORIENTEERING_CI_PROJECTS}" CACHE STRING
60+
"OpenOrienteering CI projects"
61+
FORCE
62+
)
63+
mark_as_advanced(OPENORIENTEERING_CI_PROJECTS)
64+
foreach(project ${OPENORIENTEERING_CI_PROJECTS})
65+
openorienteering_ci_add("${project}")
66+
endforeach()
67+

0 commit comments

Comments
 (0)