[cmake-developers] Response files with IAR compiler on windows

Andreas Weis der_ghulbus at ghulbus-inc.de
Mon May 22 01:52:33 EDT 2017


Hi,

We are using the IAR toolchain for cross-compiling parts of our builds 
and encountered a problem when we recently enabled response files for 
our Windows builds. It seems that the syntax used for the response file 
flags on the IAR compilers is wrong, we needed to insert a space after 
the '-f' to make it work.

I attached a patch that fixes the problem in our environment.

We are building with the 'Unix Makefiles' generator from a Cygwin shell 
in Windows. Can someone confirm that this is a proper fix for our issues 
and whether it would make sense to have the patch merged into the CMake 
trunk?

Thanks & best regards,
Andreas
-------------- next part --------------
Index: share/cmake-3.8/Modules/Compiler/IAR-C.cmake
===================================================================
--- share/cmake-3.8/Modules/Compiler/IAR-C.cmake	(revision 15921)
+++ share/cmake-3.8/Modules/Compiler/IAR-C.cmake	(working copy)
@@ -7,7 +7,7 @@
 set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
 set(CMAKE_C_CREATE_ASSEMBLY_SOURCE     "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
 
-set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "-f")
+set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "-f ")
 set(CMAKE_DEPFILE_FLAGS_C "--dependencies=ns <DEPFILE>")
 
 # The toolchains for ARM and AVR are quite different:
Index: share/cmake-3.8/Modules/Compiler/IAR-CXX.cmake
===================================================================
--- share/cmake-3.8/Modules/Compiler/IAR-CXX.cmake	(revision 15921)
+++ share/cmake-3.8/Modules/Compiler/IAR-CXX.cmake	(working copy)
@@ -7,7 +7,7 @@
 set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
 set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE     "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
 
-set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "-f")
+set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "-f ")
 set(CMAKE_DEPFILE_FLAGS_CXX "--dependencies=ns <DEPFILE>")
 
 if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM")


More information about the cmake-developers mailing list