Hello,
I'm using ninja via CMake. If I use the Unix Makefile generator I'm able to pass -DCMAKE_VERBOSE_MAKEFILE=ON
which results in verbose Makefiles by default. The Makefile generator archives this by writing VERBOSE=1
into the makefile. Is there anything it could write into a ninja file to get the same result as calling ninja via -v
?
Thanks,
Gregor
No. What's wrong with calling ninja with -v
?
This cannot be fixed by ninja alone.
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -G Ninja ../src/cmake4eclipse/testprojects/C-1src/src1
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMake 3.3 has a work-around for this: https://github.com/Kitware/CMake/commit/ce935ebe50926bde199d86fbde4a78974a4043f9
If you configure with -DCMAKE_VERBOSE_MAKEFILE=ON
then cmake --build
will add the -v
parameter to the ninja call.
Still it would be nice to get something we could add to the Ninjafiles. But currently I can live with the status-quo.
@gjasny , I use CMake 3.10 and though I set in CMakeLists.txt
the following set(CMAKE_VERBOSE_MAKEFILE ON)
I don't get any extra information form Ninja.
Any idea?
You need to make it a cache variable. Please see the CMake set command for how to do this.
For reference for others, this SET
command did the work and made Ninja verbose:
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
Still it would be nice to get something we could add to the Ninjafiles.
Why would you need that?
Please reopen, if you still think this is needed.
For other people who may have come to this bug: set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
does not seem to work on Windows. Reproduction:
CMakeLists.txt
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(simplecmake CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
add_library(simplecmake simple.cpp)
Contents of simple.cpp don't matter.
And then the script I use to run cmake.
@echo off
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
cd c:/Users/Administrator/ezyang/lab3
cd build
set CC=cl
set CXX=cl
cmake -GNinja ..
cmake --build .
Passing -DCMAKE_VERBOSE_MAKEFILE=ON
to the cmake invocation does work though.
adding set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON" FORCE)
to force cmake to swallow the setting worked for me. Perhaps you have to regenerate, though.
Most helpful comment
For reference for others, this
SET
command did the work and made Ninja verbose: