forked from ARM-software/tarmac-trace-utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (71 loc) · 2.42 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
83
84
85
86
# Copyright 2016-2021 Arm Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
#
# This file is part of Tarmac Trace Utilities
cmake_minimum_required (VERSION 3.5.1)
set(CMAKE_CXX_STANDARD 14)
project(tarmac-trace-utilities
LANGUAGES CXX)
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
include(cmake/windows.cmake)
else()
include(cmake/unix.cmake)
endif()
find_package(wxWidgets COMPONENTS core base)
# Set up the header file directory, and build the library of common
# code.
include_directories(PRIVATE include)
add_subdirectory(lib)
# Macro to mark a binary as to be installed by 'make install' or
# similar. Implementation has to vary depending on cmake version.
if(CMAKE_VERSION VERSION_LESS "3.14")
# For cmake pre-3.14, we have to specify a destination directory.
macro(install_programs)
install(TARGETS ${ARGN} RUNTIME DESTINATION bin)
endmacro()
else()
# For 3.14 and better, we can let the destination be specified
# automatically, which makes it reconfigurable independently of the
# install prefix, by setting CMAKE_INSTALL_BINDIR.
macro(install_programs)
install(TARGETS ${ARGN})
endmacro()
endif()
# Build the executable programs.
add_subdirectory(tools)
add_subdirectory(browser)
# Check if we have Python3, which is needed for the test suite.
if(CMAKE_VERSION VERSION_LESS "3.12")
# The method of finding Python was different before CMake 3.12.
set(Python_ADDITIONAL_VERSIONS 3)
find_package (PythonInterp)
if(PYTHONINTERP_FOUND AND NOT PYTHON_VERSION_MAJOR LESS 3)
set(can_run_tests ON)
set(python_exe ${PYTHON_EXECUTABLE})
endif()
else()
# Up-to-date approach.
find_package (Python3 COMPONENTS Interpreter)
if(Python3_FOUND)
set(can_run_tests ON)
set(python_exe ${Python3_EXECUTABLE})
endif()
endif()
# Run the test suite.
if(can_run_tests)
enable_testing()
add_subdirectory(tests)
else()
message(WARNING "Not running tests (failed to locate Python 3)")
endif()