Skip to content

get rid of CMP0175 CMake warning#27

Closed
valera-rozuvan wants to merge 1 commit intoRavbug:mainfrom
valera-rozuvan:get-rid-of-cmp0175-warning
Closed

get rid of CMP0175 CMake warning#27
valera-rozuvan wants to merge 1 commit intoRavbug:mainfrom
valera-rozuvan:get-rid-of-cmp0175-warning

Conversation

@valera-rozuvan
Copy link
Copy Markdown

@valera-rozuvan valera-rozuvan commented Sep 26, 2025

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 OLD behavior of this policy will accept the same invalid keywords or arguments as CMake 3.30 and earlier.

See CMP0175 docs.


On systems with CMake version 3.31 and higher - let's get rid of the warning.

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 OLD behavior of this policy will accept the same invalid keywords
or arguments as CMake 3.30 and earlier.

See https://cmake.org/cmake/help/latest/policy/CMP0175.html docs.

---

On systems with CMake version 3.31 and higher - let's get rid of the
warning.
@Ravbug
Copy link
Copy Markdown
Owner

Ravbug commented Sep 26, 2025

Shouldn't we fix the commands instead of silencing the warning?

@valera-rozuvan
Copy link
Copy Markdown
Author

@Ravbug the culprit is:

        add_custom_command(POST_BUILD
            TARGET "${EXECUTABLE_NAME}"
		    COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/src/${filename}" "${outname}"
		    DEPENDS "${filename}"
	    )

If we want to fix it - we need to remove the DEPENDS clause.

@valera-rozuvan
Copy link
Copy Markdown
Author

Also - I noticed the build is failing. This is due to the fact that CMake version running on the GitHub actions is lower, than what I was testing with. It doesn't know about the rule CMP0175:

image

@valera-rozuvan
Copy link
Copy Markdown
Author

valera-rozuvan commented Sep 27, 2025

@Ravbug would you be willing to bump CMake from the current version 3.22.1 to 3.31?

image

@Ravbug
Copy link
Copy Markdown
Owner

Ravbug commented Sep 28, 2025

I ended up fixing it by removing the invalid DEPENDS argument. Thanks for the help!
a4e429e

@Ravbug Ravbug closed this Sep 28, 2025
@valera-rozuvan valera-rozuvan deleted the get-rid-of-cmp0175-warning branch September 28, 2025 15:17
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.

2 participants