What is the preferred way to just touch the variable, inside the CMakeLists.txt?

I've got a bunch of similar ExternalProjects that are called in a loop with the same variables. Some of the projects don't need specific variables.

5

1 Answer

You could simply disable this warning all-together by passing --no-warn-unused-cli to CMake. See:

Touching the variable is explicitly not wanted according to one of the CMake authors:

Nevertheless, for variables passed by -DFOO=bar -DBAR=3 -DBAZ=true you can add a line

set(ignoreMe "${FOO}${BAZ}${BAR}") 

to one of your CMakeLists.txt which should be enough to suppress the warning.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.