-
Notifications
You must be signed in to change notification settings - Fork 0
Fix review findings. #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
|
|
||
| # Find GoogleTest package (should be found in main CMakeLists.txt) | ||
| find_package(GTest REQUIRED) | ||
| find_package(GTest CONFIG REQUIRED) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- test/CMakeLists.txt ---'
cat -n test/CMakeLists.txt
printf '%s\n' '--- test/unittests/CMakeLists.txt ---'
cat -n test/unittests/CMakeLists.txt
printf '%s\n' '--- CMake references relevant to GTest ---'
rg -n -C 3 'find_package\(GTest|GTest::|gtest_add_tests|include\(GoogleTest\)' --glob 'CMakeLists.txt' --glob '*.cmake' .Repository: kimkulling/tiny_ui Length of output: 3402 🤖 get_repo_knowledge executed:
Length of output: 12669 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- top-level CMake test/dependency flow ---'
cat -n CMakeLists.txt | sed -n '1,90p'
printf '%s\n' '--- GoogleTest dependency declarations ---'
for f in vcpkg.json vcpkg-configuration.json; do
if test -f "$f"; then
cat -n "$f"
fi
done
printf '%s\n' '--- package/configuration hints ---'
rg -n -C 3 'GTest|GoogleTest|TINY_UI_TESTS|gtest' --glob '!test/**' --glob '!CMakeLists.txt' --glob '!vcpkg.json' .Repository: kimkulling/tiny_ui Length of output: 4128 🌐 Web query:
💡 Result: To use GoogleTest with CMake, you typically use the FindGTest module or include the GoogleTest project via FetchContent [1][2][3]. 1. Using FindGTest (System-installed GoogleTest): After calling find_package(GTest REQUIRED), you can link against the following imported targets [1]: - GTest::gtest: The core GoogleTest framework [1]. - GTest::gtest_main: Includes a main function for the test executable [1]. These targets are preferred over older, deprecated variables (like GTEST_LIBRARIES) or deprecated targets (like GTest::GTest) [1][4]. 2. Integration with GoogleTest CMake Module: The GoogleTest module provides functions to integrate test execution with CTest [5][6]. - gtest_discover_tests(target): The modern, recommended way to add tests [5][6]. It discovers tests at runtime (post-build) by running the test executable, which avoids the need to re-run CMake when tests are added or renamed [5][6]. - gtest_add_tests(TARGET...): An older mechanism that scans source code at CMake configuration time [5]. It is less flexible than gtest_discover_tests and requires a CMake re-run if tests are modified [5]. To use these functions, include the module in your CMakeLists.txt [2][3]: include(GoogleTest) gtest_discover_tests(your_test_executable) When using FetchContent, the GoogleTest targets (GTest::gtest, GTest::gtest_main) are automatically made available for use with target_link_libraries [2][3]. Citations:
Keep CONFIG-mode discovery compatible with the test consumer.
🤖 Prompt for AI AgentsSource: MCP tools |
||
|
|
||
| # Enable testing | ||
| enable_testing() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.