title: Cross compile with cmake cannot link test
body: <p>I try to cross compile a library (<a href="https://www.webtoolkit.eu/wt" rel="nofollow noreferrer">Wt</a>) using CMake (2.8.12.2). I get always errors which tell me that it is not able to compile a simple test program. 
  I do not know how to make cmake to look into the right path for getting object files.
  My development and target plattform is Linux.</p>
  
  <p>The error log looks like this</p>
  
  <pre><code>Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
  Compiler: /opt/rhl/0.01/sysroots/x86_64-rhlsdk-linux/usr/bin/arm-reed-linux-gnueabi/arm-reed-linux-gnueabi-gcc 
  Build flags: ;-O2;-pipe;-g;-feliminate-unused-debug-types;
  Id flags: 
  
  The output was:
  1
  /opt/rhl/0.01/sysroots/x86_64-rhlsdk-linux/usr/libexec/arm-reed-linux-gnueabi/gcc/arm-reed-linux-gnueabi/5.3.0/real-ld: cannot find crt1.o: No such file or directory
  /opt/rhl/0.01/sysroots/x86_64-rhlsdk-linux/usr/libexec/arm-reed-linux-gnueabi/gcc/arm-reed-linux-gnueabi/5.3.0/real-ld: cannot find crti.o: No such file or directory
  ...
  </code></pre>
  
  <p>Here is my tool chain file. I could skip the test (See CMAKE_C_COMPILER_WORKS) but then I get later similar problems:</p>
  
  <pre><code>SET(CMAKE_SYSTEM_NAME Linux)
  SET(CMAKE_SYSTEM_VERSION 1)
  
  # Compiler and linker
  SET(CMAKE_C_COMPILER "/opt/rhl/0.01/sysroots/x86_64-rhlsdk-linux/usr/bin/arm-reed-linux-gnueabi/arm-reed-linux-gnueabi-gcc")
  SET(CMAKE_CXX_COMPILER "/opt/rhl/0.01/sysroots/x86_64-rhlsdk-linux/usr/bin/arm-reed-linux-gnueabi/arm-reed-linux-gnueabi-g++")
  SET(COMPILE_FLAGS " -march=armv7-a -marm -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a8 --sysroot=/opt/rhl/0.01/sysroots/cortexa8hf-neon-reed-linux-gnueabi")
  SET(CMAKE_EXE_LINKER_FLAGS " -O2 -v -o  --sysroot=/opt/rhl/0.01/sysroots/cortexa8hf-neon-reed-linux-gnueabi ")
  
  # Paths
  SET(CMAKE_PREFIX_PATH /opt/rhl/0.01/sysroots/cortexa8hf-neon-reed-linux-gnueabi/usr/)
  SET(CMAKE_SYSROOT /opt/rhl/0.01/sysroots/cortexa8hf-neon-reed-linux-gnueabi/)
  SET(CMAKE_FIND_ROOT_PATH /opt/rhl/0.01/sysroots/cortexa8hf-neon-reed-linux-gnueabi/)
  
  SET(CMAKE_COLOR_MAKEFILE ON)
  set(SHARED_LIBS OFF)
  
  # search for programs in the build host directories
  SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  # for libraries and headers in the target directories
  SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  
  # skip the compiler tests 
  # set(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
  # set(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")
  </code></pre>
  
  <p>And here is a tree view of my system. I pruned it to show the relevant part.</p>
  
  <pre><code>/opt/rhl/0.01/sysroots
  ├── cortexa8hf-neon-reed-linux-gnueabi
  │   ├── bin
  │   ├── lib
  │   ├── usr
  │   │   ├── bin
  │   │   ├── include
  │   │   ├── lib
  │   │   │   ├── crt1.o -&gt; cmake cannot find this file
  │   │   │   ├── crti.o -&gt; cmake cannot find this file
  │   │   ├── share
  │   │   └── src
  │   │           ├── gcc-runtime
  │   │           │   └── 5.3.0-r0
  └── x86_64-rhlsdk-linux
      ├── lib
      ├── sbin
      ├── usr
      │   ├── bin
      │   │   │   ├── arm-reed-linux-gcc -&gt; ../arm-reed-linux-gnueabi/arm-reed-linux-gnueabi-gcc
      │   │   ├── arm-reed-linux-gnueabi
      │   │   │   ├── arm-reed-linux-gnueabi-gcc  -&gt; The C compiler
      │   ├── include
      │   ├── lib
      │   ├── libexec
  </code></pre>