Skip to content

cmake: Fix warning suppression for googletest build - #62641

Merged
idryomov merged 1 commit into
ceph:mainfrom
tchaikov:cmake-set_property
Apr 3, 2025
Merged

idryomov merged 1 commit into
ceph:mainfrom
tchaikov:cmake-set_property

Conversation

@tchaikov

@tchaikov tchaikov commented Apr 3, 2025 •

Copy link
Copy Markdown
Contributor

In commit 27e9d56, we attempted to disable deprecated warnings when building googletest, but the implementation contained two errors:

  1. The set_property() call occurred before adding the target directory, making it impossible to set properties on non-existent objects.
  2. The -Wno-deprecated-declarations flag was incorrectly passed as an APPEND argument instead of a PROPERTY argument.

This caused build failures with libstdc++-12 and newer Clang versions:

CMake Error at src/CMakeLists.txt:772 (set_property):
  set_property given invalid argument "-Wno-deprecated-declarations".

This commit fixes both issues by:

  • Moving the set_property() call after add_subdirectory()
  • Correctly passing the warning flag as a PROPERTY argument

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

In commit 27e9d56, we attempted to disable deprecated warnings when building
googletest, but the implementation contained two errors:

1. The `set_property()` call occurred before adding the target directory,
   making it impossible to set properties on non-existent objects.
2. The `-Wno-deprecated-declarations` flag was incorrectly passed as an
   `APPEND` argument instead of a `PROPERTY` argument.

This caused build failures with libstdc++-12 and newer Clang versions:

```
CMake Error at src/CMakeLists.txt:772 (set_property):
  set_property given invalid argument "-Wno-deprecated-declarations".
```

This commit fixes both issues by:
- Moving the `set_property()` call after `add_subdirectory()`
- Correctly passing the warning flag as a `PROPERTY` argument

Signed-off-by: Kefu Chai <[email protected]>

@idryomov idryomov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax seems right to me now, although I'm not a CMake person.

@idryomov

idryomov commented Apr 3, 2025

Copy link
Copy Markdown
Contributor

Merging without waiting for @cbodley's review to reduce the number of sporadic make check failures.

@idryomov
idryomov merged commit 73c6e1b into ceph:main Apr 3, 2025
@tchaikov
tchaikov deleted the cmake-set_property branch April 3, 2025 09:13
@VallariAg VallariAg mentioned this pull request Apr 3, 2025
4 of 14 tasks
@cbodley

cbodley commented Apr 3, 2025

Copy link
Copy Markdown
Contributor

thanks @idryomov @tchaikov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants