Skip to content
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

Fix CMake warning CMP0175 #2028

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Conversation

mikes-lunarg
Copy link
Contributor

Started getting this warning on CMake 3.31+:

CMake Warning (dev) at tools/capture-vulkan/CMakeLists.txt:3 (add_custom_command):
  The following keywords are not supported when using
  add_custom_command(TARGET): DEPENDS.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

From cmake --help-policy CMP0175:

CMake 3.30 and earlier silently ignored unsupported keywords and missing or
invalid arguments for the different forms of the add_custom_command()
command. CMake 3.31 implements more rigorous argument checking and will flag
invalid or missing arguments as errors.

The simplest fix seems to be just adding the copy command to the custom target and getting rid of the custom command.

Started getting this warning on CMake 3.31+:

```
CMake Warning (dev) at tools/capture-vulkan/CMakeLists.txt:3 (add_custom_command):
  The following keywords are not supported when using
  add_custom_command(TARGET): DEPENDS.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.
```

From `cmake --help-policy CMP0175`:
> CMake 3.30 and earlier silently ignored unsupported keywords and missing or
> invalid arguments for the different forms of the ``add_custom_command()``
> command. CMake 3.31 implements more rigorous argument checking and will flag
> invalid or missing arguments as errors.

The simplest fix seems to be just adding the copy command to the custom target
and getting rid of the custom command.
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 373633.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 6078 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 6078 passed.

@bradgrantham-lunarg
Copy link
Contributor

Did you test this against anything earlier than CMake 3.31?

@mikes-lunarg
Copy link
Contributor Author

Did you test this against anything earlier than CMake 3.31?

I also tested on 3.22.1 (Ubuntu 22.04 LTS) and 3.16.3 (cmake_minimum_required)

@mikes-lunarg mikes-lunarg merged commit ed53007 into LunarG:dev Feb 17, 2025
9 checks passed
@mikes-lunarg mikes-lunarg deleted the cmake-warning branch February 17, 2025 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants