-
Notifications
You must be signed in to change notification settings - Fork 20
/
CMakeLists.txt
82 lines (65 loc) · 2.58 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright (c) 2017-2019, Battelle Memorial Institute; Lawrence Livermore
# National Security, LLC; Alliance for Sustainable Energy, LLC.
# See the top-level NOTICE for additional details.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake_minimum_required(VERSION 3.4)
cmake_policy(VERSION 3.4)
project (HELICS-EXAMPLES VERSION 2.3.0)
# -----------------------------------------------------------------------------
# include some common macros
# -----------------------------------------------------------------------------
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(GNUInstallDirs)
# -------------------------------------------------------------
# setting the RPATH
# -------------------------------------------------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_MACOSX_RPATH ON)
# add the automatically determined parts of the RPATH which point to directories outside
# the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
list(
FIND
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" isSystemDir
)
if("${isSystemDir}" STREQUAL "-1")
list(
APPEND
CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}"
)
endif()
list(
FIND
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir
)
if("${isSystemDir}" STREQUAL "-1")
list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()
# add the local directory to the rpath
list(APPEND CMAKE_INSTALL_RPATH "./")
# -----------------------------------------------------------------------------
# CMAKE Subdirectories
# -----------------------------------------------------------------------------
OPTION(ENABLE_C_EXAMPLES "Enable the C based examples to be built" ON)
OPTION(ENABLE_CPP_EXAMPLES "Enable the C++ based examples to be built" ON)
OPTION(ENABLE_CPP98_EXAMPLES "Enable the C++98 based examples to be built" ON)
if (ENABLE_C_EXAMPLES)
add_subdirectory(c)
endif()
if (ENABLE_CPP_EXAMPLES)
add_subdirectory(cpp)
endif()
if (ENABLE_CPP98_EXAMPLES)
add_subdirectory(cpp98)
endif()