title: How do I tell CMake to specify multiple linker script files to GCC?
body: <p>I"m using CMake 3.17 and the GNU ARM toolchain and I'm trying to migrate a build from Eclipse to CMake. Part of the Eclipse build specifies multiple linker script files to use at link time so I set up my CMakeLists.txt file like this:</p>
  
  <pre><code>target_link_options(${application_name} PRIVATE
      -mcpu=cortex-m4
      -mthumb 
      -mfloat-abi=hard 
      -mfpu=fpv4-sp-d16 
      -fmessage-length=0 
      -fsigned-char 
      -ffunction-sections 
      -fdata-sections 
      -flto 
      -Wall
      -Xlinker --gc-sections 
      -Wl,-Map,${map_file}
      -T ${CMAKE_SOURCE_DIR}/ldscripts/libs.ld
      -T ${CMAKE_SOURCE_DIR}/ldscripts/mem.ld
      -T ${CMAKE_SOURCE_DIR}/ldscripts/sections.ld
  )
  </code></pre>
  
  <p>But when I run <code>make</code> the <code>-T</code> option gets swallowed for the second and third files. Here's what I get when running <code>make VERBOSE=1</code> after successful compilation of all sources. The linker command line followed by a warning about missing <code>-T</code> options:</p>
  
  <pre><code>Linking CXX executable StartupSequence.elf
  /D/gcc-arm-none-eabi-9-2019-q4/bin/arm-none-eabi-g++.exe    --specs=nano.specs --specs=nosys.specs -g -Og -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -flto -Wall -Xlinker --gc-sections -Wl,-Map,StartupSequence.map -T C:/svn/startup_sequence/ldscripts/libs.ld C:/svn/startup_sequence/ldscripts/mem.ld C:/svn/startup_sequence/ldscripts/sections.ld @CMakeFiles/StartupSequence.dir/objects1.rsp  -o StartupSequence.elf  ../Drivers/CMSIS/DSP/Lib/libarm_cortexM4lf_math.a ../Middlewares/Third_Party/mbedTLS/library/libmbedcrypto.a
  d:/gcc-arm-none-eabi-9-2019-q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: C:/svn/startup_sequence/ldscripts/sections.ld contains output sections; did you forget -T?
  </code></pre>
  
  <p>Why does the <code>-T</code> not get sent to the command line properly for the last two files?</p>
  
  <p>I've tried separating the link script specification into three separate calls to <code>target_link_options</code> and enclosing each script specification in double quotes but it seems to have no effect.</p>