How to build with CMake to both release config and verbose

4.8k Views Asked by At

I am trying to build with CMake and to pass both options: config: Release and VERBOSE=ON:

cmake --build . --config Release -- VERBOSE=ON

And in CMake of Visual I have the switch:

cmake -G "Visual Studio 14 2015"
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^

if I pass only '--config Release' it works.

Now it's failing with this message:

15:40:51 MSBUILD : error MSB1008: Only one project can be specified.
15:40:51 Switch: VERBOSE=1
15:40:51 
15:40:51 For switch syntax, type "MSBuild /help"
1

There are 1 best solutions below

1
On BEST ANSWER

VERBOSE=ON is not understood by MSBuild.

You probably know that syntax from Unix Makefile generators, where setting eg. the VERBOSE environment variable will give you the verbose output. Note that this is a feature of the generator (ie. make) and not of CMake. Thus when switching to a different generator (in this case MSBuild), you have to find a different way to get the verbose output that works with that generator.

For MSBuild, that would be the /verbosity option. See also this answer for details.

As for the CMAKE_VERBOSE_MAKEFILE option, the manual clearly states that this option only has an effect for Makefile generators (emphasis added by me):

Users may enable the option in their local build tree to get more verbose output from Makefile builds and show each command line as it is launched.