title: How to Trace CMakeLists.txt
body: <p>Is there a way to examine what <code>cmake</code> is doing in a failing run?  For example, I have a program depending on libbacktrace, which I can link to by <code>gcc foo.c -lbacktrace</code>.  But when I write a <code>CMakeLists.txt</code> like</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  find_library (BACKTRACE_LIBRARY backtrace)
  message (BACKTRACE_LIBRARY=${BACKTRACE_LIBRARY})
  </code></pre>
  
  <p>and type <code>cmake &lt;path&gt;</code>, it prints out <code>BACKTRACE_LIBRARY=BACKTRACE_LIBRARY-NOTFOUND</code>.</p>
  
  <p>How do I go about figuring out where the problem is?  What commands is <code>cmake</code> executing before giving up on finding libbacktrace?  Is it executing anything at all?  In autoconf, the commands are all recorded in <code>config.log</code>, but <code>CMakeOutput.log</code> in this case is blank.  Likewise, <code>cmake --trace</code> only echoes the contents of <code>CMakeLists.txt</code> after a bunch of system cmake files, which is useless in this case.</p>
  
  <p>Please note that I'm not looking for a way to make this particular invocation of <code>find_library</code> work - that's just an example.  My question is: I have a CMakeLists.txt that isn't working as expected; what tools exist to help me figure out where and why it's failing?</p>