Pass include directories with response files to GNU on Windows

The GNU 4.x toolchain on MinGW (and therefore MSYS) allows compiler
options to be passed via response files.  Use this to pass include
directory -I options.  This allows the include file search path to be
very long despite shell and mingw32-make command line length limits.
This commit is contained in:
Brad King 2011-03-17 15:44:57 -04:00
parent 9a0b9bc8b7
commit 86cb17b18d
1 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,7 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE}) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
# We prefer "@" for response files but it is not supported by gcc 3. # We prefer "@" for response files but it is not supported by gcc 3.
execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE _ver ERROR_VARIABLE _ver) execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE _ver ERROR_VARIABLE _ver)
@ -91,6 +92,8 @@ macro(__windows_compiler_gnu lang)
# Use "-Wl,@" to pass the response file to the linker. # Use "-Wl,@" to pass the response file to the linker.
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@")
endif() endif()
# The GNU 3.x compilers do not support response files (only linkers).
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0)
elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS) elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS)
# Use "@" to pass the response file to the front-end. # Use "@" to pass the response file to the front-end.
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")