-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
37 lines (26 loc) · 948 Bytes
/
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
cmake_minimum_required(VERSION 3.17)
project(rpp LANGUAGES CXX)
option(RPP_TEST "Build tests" OFF)
option(RPP_QEMU "Run tests with qemu-aarch64" OFF)
add_subdirectory("rpp/")
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(HAS_PARENT)
set(RPP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
endif()
if(RPP_TEST)
set(RPP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
enable_testing()
add_subdirectory("test/")
file(GLOB TEST_SOURCES test/*.cpp)
foreach(test ${TEST_SOURCES})
get_filename_component(testname ${test} NAME_WE)
if(RPP_QEMU)
set(command qemu-aarch64 -L /usr/aarch64-linux-gnu/ $<TARGET_FILE:${testname}>)
else()
set(command $<TARGET_FILE:${testname}>)
endif()
add_test(NAME ${testname}
COMMAND ${command}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test")
endforeach(test ${TEST_SOURCES})
endif()