Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake & Visual Studio: How to get a quick, quiet command line build?

I've got a cmake project that successfully does everything that I want. But I've got about 100 files, and I tire of seeing the huge output that is generated, 30 lines per file every time when I only need to recompile a single file.

To be clear, I'm compiling cmake --build . to get this result.

What is the parameter that I need to pass to the compiler (or MSBuild) to skip the printing that it checked the unchanged files? Compiling the project inside Visual Studio doesn't create all of this visual garbage.

This is the output that I'm getting for every unchanged file:

Project "C:\noscan\working\proj\build\ALL_BUILD.vcxproj" (1) is building "C:\noscan\working\proj\build\os\src\oslib.vcxproj" (54) on node 1 (default targets).
InitializeBuildStatus:
  Creating "oslib.dir\Debug\oslib.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
PreBuildEvent:
  Description: Automatic MOC for target oslib
  setlocal
  cd C:\noscan\working\tadet\build\os\src
  if %errorlevel% neq 0 goto :cmEnd
  C:
  if %errorlevel% neq 0 goto :cmEnd
  C:\cmake\bin\cmake.exe -E cmake_autogen     C:/noscan/working/tadet/build/os/src/CMakeFiles/oslib_autogen.dir Debug
  if %errorlevel% neq 0 goto :cmEnd
  :cmEnd
  endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  :cmErrorLevel
  exit /b %1
  :cmDone
  if %errorlevel% neq 0 goto :VCEnd
  :VCEnd
CustomBuild:
  All outputs are up-to-date.
ClCompile:
  All outputs are up-to-date.
Lib:
  All outputs are up-to-date.
  oslib.vcxproj -> C:\noscan\working\proj\build\os\src\oslib.dir\Debug\oslib.lib
FinalizeBuildStatus:
  Deleting file "oslib.dir\Debug\oslib.tlog\unsuccessfulbuild".
  Touching "oslib.dir\Debug\oslib.tlog\oslib.lastbuildstate".
Done Building Project "C:\noscan\working\proj\build\os\src\oslib.vcxproj" (default targets).
like image 289
PfunnyGuy Avatar asked Jan 19 '18 15:01

PfunnyGuy


1 Answers

You can pass additional arguments to the platfom specific build tool (MSBuild in this case) after the -- (see https://cmake.org/cmake/help/v3.10/manual/cmake.1.html for detailed description of --build and build-tool-options). I use the following command in my local build script cmake --build . --target INSTALL --config Debug -- /nologo /verbosity:minimal /l:FileLogger,Microsoft.Build.Engine;logfile=%CWD%\MSBuild_%BUILD_NAME%_%PLATFORM%_Debug.log for an almost quiet build.

like image 70
vre Avatar answered Sep 21 '22 10:09

vre