From f692439d1ef5dc858d284cf36c79e23b97b5540e Mon Sep 17 00:00:00 2001 From: Jami Kettunen Date: Sun, 26 Feb 2023 16:20:48 +0200 Subject: tests: Fix building against modern GTest Fixes being unable to locate GMock (GTest) with gtest v1.12.1 as tested on Void Linux: CMake Warning at tests/CMakeLists.txt:1 (find_package): By not providing "FindGMock.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "GMock", but CMake did not find one. Could not find a package configuration file provided by "GMock" with any of the following names: GMockConfig.cmake gmock-config.cmake Add the installation prefix of "GMock" to CMAKE_PREFIX_PATH or set "GMock_DIR" to a directory containing one of the above files. If "GMock" provides a separate development package or SDK, be sure it has been installed. Also mark the library as REQUIRED since without it found attempting to build tests just fails at link-time with various errors such as: /usr/bin/ld: gtest-menuitems.cpp:(.text+0x14d): undefined reference to `testing::internal::GetBoolAssertionFailureMessage[abi:cxx11](testing::AssertionResult const&, char const*, char const*, char const*)' --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 74a258f..28c5727 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(GMock) +find_package(GTest REQUIRED) # gtest-menuitems -- cgit v1.2.3 From 889c006f9fcc57889ccb7d10ebadcf53463ae24c Mon Sep 17 00:00:00 2001 From: Jami Kettunen Date: Sun, 26 Feb 2023 16:26:47 +0200 Subject: cmake: Enable building tests by default We really should do this by default across the board to catch issues with the testing infrastructure; what's the point of having tests if they're not even being actively exercised across a wide range of distributions with varying configurations? :p --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc4295f..7bbc464 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # Options -option(ENABLE_TESTS "Enable all tests and checks" OFF) +option(ENABLE_TESTS "Enable all tests and checks" ON) option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF) option(ENABLE_WERROR "Treat all build warnings as errors" OFF) -- cgit v1.2.3