-
Notifications
You must be signed in to change notification settings - Fork 51
Add find package gtest and yaml-cpp package #136
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
Merged
mschulfe
merged 3 commits into
intel:main
from
aaroncyew:dev/fedora/rawhide/cmake-gtest-yaml-cpp
Jun 2, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # | ||
| # Copyright (C) 2022-2024 Intel Corporation | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
|
|
||
| # Try to find system-installed GoogleTest package | ||
| # Package names vary by distribution: | ||
| # - Fedora/RHEL/openSUSE Tumbleweed: gtest-devel (provides gmock-devel as well) | ||
| # - Ubuntu/Debian: libgtest-dev | ||
| find_package(GTest QUIET) | ||
|
|
||
| if(NOT GTest_FOUND) | ||
| message(STATUS "System GoogleTest not found, building from submodule") | ||
| set(INSTALL_GTEST OFF) | ||
| add_subdirectory(googletest EXCLUDE_FROM_ALL) | ||
| else() | ||
| message(STATUS " Found gtest, version ${GTest_VERSION}") | ||
| # Display include directories and library paths for each target | ||
| if(TARGET GTest::gtest) | ||
| get_target_property(GTEST_INCLUDE_DIRS GTest::gtest INTERFACE_INCLUDE_DIRECTORIES) | ||
| get_target_property(GTEST_LOCATION GTest::gtest LOCATION) | ||
| message(STATUS "GTest_INCLUDE_DIRS : ${GTEST_INCLUDE_DIRS}") | ||
| message(STATUS "GTest_LIBRARIES : ${GTEST_LOCATION}") | ||
| message(STATUS "GTest_VERSION : ${GTest_VERSION}") | ||
| endif() | ||
|
|
||
| if(TARGET GTest::gmock) | ||
| get_target_property(GMOCK_INCLUDE_DIRS GTest::gmock INTERFACE_INCLUDE_DIRECTORIES) | ||
| get_target_property(GMOCK_LOCATION GTest::gmock LOCATION) | ||
| message(STATUS "GMock_INCLUDE_DIRS : ${GMOCK_INCLUDE_DIRS}") | ||
| message(STATUS "GMock_LIBRARIES : ${GMOCK_LOCATION}") | ||
| message(STATUS "GMock_VERSION : ${GTest_VERSION}") | ||
| endif() | ||
|
|
||
| # Create aliases for consistency with submodule build | ||
| # The submodule provides 'gtest' and 'gmock' targets | ||
| # System package provides 'GTest::gtest', 'GTest::gmock', etc. | ||
| if(NOT TARGET gtest) | ||
| add_library(gtest ALIAS GTest::gtest) | ||
| endif() | ||
| if(NOT TARGET gmock) | ||
| add_library(gmock ALIAS GTest::gmock) | ||
| endif() | ||
| if(NOT TARGET gtest_main AND TARGET GTest::gtest_main) | ||
| add_library(gtest_main ALIAS GTest::gtest_main) | ||
| endif() | ||
| if(NOT TARGET gmock_main AND TARGET GTest::gmock_main) | ||
| add_library(gmock_main ALIAS GTest::gmock_main) | ||
| endif() | ||
| endif() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # | ||
| # Copyright (C) 2022-2024 Intel Corporation | ||
|
jwludzik marked this conversation as resolved.
Outdated
|
||
| # | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
|
|
||
| # Try to find system-installed yaml-cpp package | ||
| # Package names vary by distribution: | ||
| # - Fedora/RHEL/openSUSE Tumbleweed: yaml-cpp-devel | ||
| # - Ubuntu/Debian: libyaml-cpp-dev | ||
| find_package(yaml-cpp QUIET) | ||
|
|
||
| if(NOT yaml-cpp_FOUND) | ||
| message(STATUS "System yaml-cpp not found, building from submodule") | ||
| set(YAML_CPP_INSTALL OFF) | ||
| set(BUILD_SHARED_LIBS OFF) | ||
| add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL) | ||
| endif() | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.