1 From 21a33ac3b07b00b510c80f50bde7cc42dcada039 Mon Sep 17 00:00:00 2001
2 From: Scott Murray <scott.murray@konsulko.com>
3 Date: Thu, 6 Oct 2022 13:31:02 -0400
4 Subject: [PATCH 3/3] Disable default fetch and build of googletest
6 The logic in test/unit-test/CMakeLists.txt was always fetching and
7 building googletest even if the unit-test was not enabled (which is
8 the default), rework it a bit to only do so when the unit-test is
11 Upstream-Status: Pending
13 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
15 .../test/unit-test/CMakeLists.txt | 42 +++++++++----------
16 1 file changed, 21 insertions(+), 21 deletions(-)
18 diff --git a/kuksa-val-server/test/unit-test/CMakeLists.txt b/kuksa-val-server/test/unit-test/CMakeLists.txt
19 index 55eedc9..6cec94f 100644
20 --- a/kuksa-val-server/test/unit-test/CMakeLists.txt
21 +++ b/kuksa-val-server/test/unit-test/CMakeLists.txt
22 @@ -16,18 +16,6 @@ enable_testing()
26 -FetchContent_Declare(
28 - GIT_REPOSITORY https://github.com/google/googletest.git
29 - GIT_TAG release-1.11.0
32 -FetchContent_GetProperties(googletest)
33 -if(NOT googletest_POPULATED)
34 - FetchContent_Populate(googletest)
35 - add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
39 # CMake configuration responsible for building kuksa-val optional unit tests based on core library
41 @@ -37,18 +25,30 @@ set(UNITTEST_EXE_NAME "kuksaval-unit-test" )
43 set(BUILD_UNIT_TEST OFF CACHE BOOL "Build unit tests")
48 + FetchContent_Declare(
50 + GIT_REPOSITORY https://github.com/google/googletest.git
51 + GIT_TAG release-1.11.0
54 -set(proto_gen_dir "${CMAKE_BINARY_DIR}/proto")
55 -include_directories(${proto_gen_dir})
56 -include_directories(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
57 + FetchContent_GetProperties(googletest)
58 + if(NOT googletest_POPULATED)
59 + FetchContent_Populate(googletest)
60 + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
63 -# Prevent GoogleTest from overriding our compiler/linker options
64 -# when building with Visual Studio
65 -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
69 + set(proto_gen_dir "${CMAKE_BINARY_DIR}/proto")
70 + include_directories(${proto_gen_dir})
71 + include_directories(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
73 + # Prevent GoogleTest from overriding our compiler/linker options
74 + # when building with Visual Studio
75 + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
78 add_executable(${UNITTEST_EXE_NAME}
79 AccessCheckerTests.cpp
80 AuthenticatorTests.cpp