Skip to content

Commit 4e35514

Browse files
Merge pull request #2377 from mavlink/cmake-build-testing
Add a BUILD_TESTING option to superbuild
2 parents 3b779fb + deaa625 commit 4e35514

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
id: cache
8787
with:
8888
path: ./build/release/third_party/install
89-
key: ${{ github.job }}-${{ matrix.ubuntu_image }}-${{ hashFiles('./third_party/**') }}
89+
key: ${{ github.job }}-${{ matrix.ubuntu_image }}-${{ hashFiles('./third_party/**') }}-1
9090
- name: disable superbuild on cache hit
9191
if: steps.cache.outputs.cache-hit == 'true'
9292
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/release/third_party/install" >> $GITHUB_ENV

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ option(BUILD_MAVSDK_SERVER "Build mavsdk_server" OFF)
66
option(BUILD_WITH_PROTO_REFLECTION "Build mavsdk_server with proto reflection" OFF)
77
option(BUILD_SHARED_LIBS "Build core as shared libraries instead of static ones" ON)
88
option(MAVLINK_DIALECT "MAVLink dialect. Default: common" "common")
9+
option(BUILD_TESTING "Build tests" ON)
910

1011
if (SUPERBUILD AND HUNTER_ENABLED)
1112
message(FATAL_ERROR "Cannot SUPERBUILD while HUNTER_ENABLED. Set -DSUPERBUILD=OFF when using Hunter")

debian/rules

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ override_dh_auto_configure:
1010
dh_auto_configure -O--buildsystem=cmake -O--builddirectory=build -- \
1111
-DCMAKE_BUILD_TYPE=Release \
1212
-DBUILD_SHARED_LIBS=ON \
13-
-DBUILD_TESTS=OFF \
13+
-DBUILD_TESTING=OFF \
1414
-DSUPERBUILD=OFF \
1515
-DCMAKE_INSTALL_PREFIX=/usr

src/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if(CCACHE AND CCACHE_PROGRAM AND NOT DEFINED ENV{CCACHE_DISABLE})
2424
endif()
2525
endif()
2626

27-
option(BUILD_TESTS "Build tests" ON)
27+
option(BUILD_TESTING "Build tests" ON)
2828
option(CMAKE_POSITION_INDEPENDENT_CODE "Position independent code" ON)
2929

3030
include(cmake/compiler_flags.cmake)
@@ -43,9 +43,9 @@ hunter_add_package(lzma)
4343
find_package(CURL REQUIRED)
4444
find_package(LibLZMA REQUIRED)
4545

46-
if(BUILD_TESTS AND (IOS OR ANDROID))
47-
message(STATUS "Building for iOS or Android: forcing BUILD_TESTS to FALSE...")
48-
set(BUILD_TESTS OFF)
46+
if(BUILD_TESTING AND (IOS OR ANDROID))
47+
message(STATUS "Building for iOS or Android: forcing BUILD_TESTING to FALSE...")
48+
set(BUILD_TESTING OFF)
4949
endif()
5050

5151
if(ANDROID)
@@ -70,7 +70,7 @@ add_subdirectory(mavsdk)
7070

7171
include(cmake/static_analyzers.cmake)
7272

73-
if(BUILD_TESTS)
73+
if(BUILD_TESTING)
7474
enable_testing()
7575

7676
add_subdirectory(integration_tests)

src/mavsdk_server/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ find_package(gRPC REQUIRED)
66

77
add_subdirectory(src)
88

9-
if(BUILD_TESTS)
9+
if(BUILD_TESTING)
1010
add_subdirectory(test)
1111
endif()

third_party/CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include(cmake/build_target.cmake)
77
list(APPEND CMAKE_PREFIX_PATH "${DEPS_INSTALL_PATH}")
88
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
99

10-
if (SUPERBUILD)
10+
if(SUPERBUILD)
1111
build_target(mavlink)
1212
build_target(jsoncpp)
1313
build_target(tinyxml2)
@@ -29,12 +29,14 @@ if (SUPERBUILD)
2929
build_target(grpc)
3030
endif()
3131

32-
build_target(gtest)
32+
if(BUILD_TESTING)
33+
build_target(gtest)
34+
endif()
3335

3436
endif()
3537

3638
build_target(libevents)
3739

38-
if (ENABLE_CPPTRACE)
40+
if(ENABLE_CPPTRACE)
3941
build_target(cpptrace)
4042
endif()

0 commit comments

Comments
 (0)