title: CMake AMRCC + custom linker
body: <p>I'm trying to use <code>cmake</code> in a project which is compiled using <code>armcc</code>, but use a custom proprietary linker (not <code>armlink</code>).<br/><br/></p>
  
  <p>I've changed the variables in the <code>toolchain.cmake</code> file as following:</p>
  
  <pre><code>unset (CMAKE_LINKER CACHE)
  set (CMAKE_LINKER "my_linker" CACHE STRING "" FORCE)
  
  unset (CMAKE_ARMCC_LINKER CACHE)
  set (CMAKE_ARMCC_LINKER "my_linker" CACHE STRING "" FORCE)
  
  unset (CMAKE_EXE_LINKER_FLAGS CACHE )
  set (CMAKE_EXE_LINKER_FLAGS "-flag1 -flag2" CACHE STRING "" FORCE)
  
  unset (CMAKE_C_LINK_EXECUTABLE)
  set (CMAKE_C_LINK_EXECUTABLE "&lt;CMAKE_LINKER&gt; &lt;CMAKE_EXE_LINKER_FLAGS&gt; &lt;OBJECTS&gt; &lt;LINK_LIBRARIES&gt; -o &lt;TARGET&gt;")
  
  unset (CMAKE_CXX_LINK_EXECUTABLE)
  set (CMAKE_CXX_LINK_EXECUTABLE "&lt;CMAKE_LINKER&gt; &lt;CMAKE_EXE_LINKER_FLAGS&gt; &lt;OBJECTS&gt; &lt;LINK_LIBRARIES&gt; -o &lt;TARGET&gt;")
  </code></pre>
  
  <p>But when <code>cmake</code> tries to check my compiler suite, it fails in the linking step:</p>
  
  <pre><code>-- Check for working C compiler: armcc.exe -- broken
  CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (message):
    The C compiler "armcc.exe" is not able to compile a simple test program.
  
  ... (compiling commands that worked hidden here)
  
  Linking C executable cmTC_c08ef.elf
  
  "C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_c08ef.dir\link.txt --verbose=1
  
  my_linker -flag1 -flag2 CMakeFiles/cmTC_c08ef.dir/testCCompiler.o -o cmTC_c08ef.elf --list cmTC_c08ef.map
  </code></pre>
  
  <p>The problem is the <code>--list cmTC_c08ef.map</code> at the end of command line (which does not exist in the <code>toolchain.cmake</code> file).</p>
  
  <p>In order to make it work, I need to change the file <code>&lt;cmake_install_dir&gt;\Modules\Compiler\ARMCC.cmake</code> as following:</p>
  
  <pre><code>  set(CMAKE_${lang}_LINK_EXECUTABLE      "&lt;CMAKE_LINKER&gt; &lt;CMAKE_${lang}_LINK_FLAGS&gt; &lt;LINK_FLAGS&gt; &lt;LINK_LIBRARIES&gt; &lt;OBJECTS&gt; -o &lt;TARGET&gt; --list &lt;TARGET_BASE&gt;.map")
  #  set(CMAKE_${lang}_LINK_EXECUTABLE      "&lt;CMAKE_LINKER&gt; &lt;CMAKE_${lang}_LINK_FLAGS&gt; &lt;LINK_FLAGS&gt; &lt;LINK_LIBRARIES&gt; &lt;OBJECTS&gt; -o &lt;TARGET&gt;")
  </code></pre>
  
  <p>There is a better approach to solve this issue or it is the only way?</p>
  
  <p>Edit: Apparently this is a bug in the cmake's armcc support, so I will keep my change in the ARMCC.cmake file.</p>