title: Unable to cross compile with cmake 2.8
body: <p>I have the following build structure:</p>
  
  <pre><code>/blah/3rdparty/yang
  /blah/3rdparty/Makefile
  /blah/3rdparty/toolchain.cmake
  /blah/3rdparty/yang/libyang-0.14.78
  </code></pre>
  
  <p>And I have this mockup <code>Makefile</code> that I am trying to invoke the underlaying cmake</p>
  
  <pre><code>all: prep
  
  prep:
          cd libyang-0.14.78 ; \
          cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake \
          -DENABLE_BUILD_TESTS=OFF \
          -DENABLE_VALGRIND_TESTS=OFF \
          -DPCRE_LIBRARY=/blah/lib/lipcre.so \
          -DPCRE_INCLUDE_DIR=/blah/include \
          -DCMAKE_BUILD_TYPE:String="Release"
  </code></pre>
  
  <p>However no matter what I do, the <code>cmake</code> won't pick up the settings in <code>toolchain.cmake</code> I'm passing to it.</p>
  
  <p>The <code>toolchain.cmake</code>:</p>
  
  <pre><code>SET(CMAKE_SYSTEM_NAME Linux)
  SET(CMAKE_SYSTEM_PROCESSOR arm)
  SET(CMAKE_C_COMPILER arm-openwrt-linux-gcc)
  SET(CMAKE_CXX_COMPILER arm-openwrt-linux-gcc)
  SET(host arm-linux)
  SET(SYSROOT /blah/tools/armv7-openwrt-linux-gnu-uClibc-0.9.33.2)
  SET(CMAKE_SYSROOT ${SYSROOT})
  SET(CMAKE_FIND_ROOT_PATH ${SYSROOT})
  SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  </code></pre>
  
  <p>When I go check which executables it is using, all i see is the host executables, and not from my toolchain... This is what cmake prints out when I use the <code>-LAH</code> option to it...</p>
  
  <pre><code>// Path to a program.
  CMAKE_AR:FILEPATH=/usr/bin/ar
  // C compiler.
  CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc
  // Path to a program.
  CMAKE_LINKER:FILEPATH=/usr/bin/ld
  </code></pre>
  
  <p>CMake version is <code>2.8.12.2</code> and I can't upgrade the version.</p>
  
  <p>Questions:</p>
  
  <ul>
  <li>If I <strong>absolutely</strong> need to to it this way, what is the proper way to invoke <code>cmake</code> from a <code>Makefile</code>?</li>
  <li>Am I invoking the <code>prep</code> correctly? It seems that <code>CMAKE_TOOLCHAIN_FILE</code> or the rest of the settings never carried over.</li>
  <li>Is my <code>toolchain.cmake</code> correct?</li>
  </ul>