--- apitrace-11.1/CMakeLists.txt 2022-05-21 00:14:48.000000000 +1000 +++ apitrace-11.1-patched/CMakeLists.txt 2023-09-23 08:21:56.858903298 +1000 @@ -492,7 +492,9 @@ pkg_check_modules (BROTLIENC IMPORTED_TARGET libbrotlienc>=1.0.7) endif () - find_package (GTest) + if (BUILD_TESTING) + find_package (GTest) + endif () endif () add_subdirectory (thirdparty) @@ -504,12 +506,15 @@ include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/khronos) # Convenience macro for adding unit tests -macro (add_gtest) - add_executable (${ARGV}) - target_link_libraries (${ARGV0} GTest::GTest) - add_dependencies (check ${ARGV0}) - add_test (NAME ${ARGV0} COMMAND ${ARGV0}) -endmacro () +# Should only be invoked when BUILD_TESTING is enabled +if (BUILD_TESTING) + macro (add_gtest) + add_executable (${ARGV}) + target_link_libraries (${ARGV0} GTest::GTest) + add_dependencies (check ${ARGV0}) + add_test (NAME ${ARGV0} COMMAND ${ARGV0}) + endmacro () +endif () ############################################################################## --- apitrace-11.1/thirdparty/CMakeLists.txt 2022-05-21 00:14:48.000000000 +1000 +++ apitrace-11.1-patched/thirdparty/CMakeLists.txt 2023-09-23 08:21:56.859903298 +1000 @@ -23,12 +23,12 @@ zlib/README ) if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${path}") - message (SEND_ERROR "error: ${CMAKE_CURRENT_SOURCE_DIR}/${path} does not exist") + message (STATUS "${CMAKE_CURRENT_SOURCE_DIR}/${path} does not exist, relying on system version") set (SUBMODULES_MISSING TRUE) endif () endforeach () if (SUBMODULES_MISSING) - message (FATAL_ERROR "Update Git submodules by running\ngit submodule update --init --depth 1 --recursive") + message (WARNING "If any dependencies are not found, update Git submodules by running\ngit submodule update --init --depth 1 --recursive") endif () if (ENABLE_STATIC_SNAPPY OR NOT Snappy_FOUND) @@ -56,7 +56,7 @@ endif () # We use non-standard C++ flags, so we can't just use GTest's CMakeLists.txt -if (NOT GTEST_FOUND) +if (BUILD_TESTING AND NOT GTEST_FOUND) message (STATUS "Using bundled GTest") include_with_scope (gtest.cmake) endif ()