Verbose cmake: How to get more diagnostics?

Serge Rogatch picture Serge Rogatch · Jan 16, 2017 · Viewed 14.1k times · Source

I am getting some strange error from cmake :

loading initial cache file ../../Tweaks/compiler-rt/arm.txt
-- Performing Test COMPILER_RT_HAS_FPIE_FLAG
CMake Error at CMakeLists.txt:2 (set):
  Syntax error in cmake code at

    D:/Work/AcSo/Views/llvmSecond/build-arm/compiler-rt/CMakeFiles/CMakeTmp/CMakeLists.txt:2

  when parsing string

    D:/Work/AcSo/Views/llvmSecond/llvm/projects/compiler-rt/cmake;D:/Work/AcSo/Views/llvmSecond/llvm/projects/compiler-rt/cmake/Modules;D:/Work/AcSo/Views/llvmSecond/llvm/cmake;D:\Work\AcSo\Views\llvmSecond\build-host\Release\lib\cmake\llvm

  Invalid character escape '\W'.


CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Configuring incomplete, errors occurred!
See also "D:/Work/AcSo/Views/llvmSecond/build-arm/compiler-rt/CMakeFiles/CMakeOutput.log".

All I could understand is that it gets a windows path somehow, and then complains about \W character sequence. Actually I've done what I could to give cmake Linux paths. So I don't know where the Windows path comes from. Nothing seems essential for this error in CMakeOutput.log

I would like to get more diagnostics from cmake, i.e. what and why it does, but searching for "cmake verbose" instead gives results about making the make verbose, not cmake itself.

Is there a way to force cmake verbose / get more diagnostics / debug or trace output? Or if you can tell what's the problem in my specific case, that's appreciated too.

Answer

Serge Rogatch picture Serge Rogatch · Jan 17, 2017

In this particular situation, cmake flags --trace and --debug-output suggested for the questions linked in the comments, were not as helpful as --debug-trycompile flag, which keeps such files as CMakeFiles/CMakeTmp/CMakeLists.txt (so they don't get removed when cmake fails).