]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
cmake: Fix warning suppression for googletest build
authorKefu Chai <tchaikov@gmail.com>
Thu, 3 Apr 2025 02:03:08 +0000 (10:03 +0800)
committerKefu Chai <tchaikov@gmail.com>
Thu, 3 Apr 2025 02:14:08 +0000 (10:14 +0800)
commit08ce6dc51b1d9956b3e63b43da315fa4567fc80f
tree959bbb3af8d0c2a54b13d3811b4b09080ebf16c8
parentbdb67a679c3162628017b9ac9a1c610b99ba99f7
cmake: Fix warning suppression for googletest build

In commit 27e9d563, 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 <tchaikov@gmail.com>
src/CMakeLists.txt