Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get rid of CMake warning 'Manually-specified variables were not used by the project'

Tags:

cmake

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.

like image 513
Velkan Avatar asked Apr 06 '16 12:04

Velkan


1 Answers

You could simply disable this warning all-together by passing --no-warn-unused-cli to CMake. See: https://cmake.org/cmake/help/v3.5/manual/cmake.1.html

Touching the variable is explicitly not wanted according to one of the CMake authors: https://cmake.org/pipermail/cmake/2011-February/042908.html

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.

like image 61
usr1234567 Avatar answered Sep 20 '22 18:09

usr1234567