Ninja: also detect /showInclude prefix for icl

This commit is contained in:
Peter Kümmel 2012-08-27 14:49:51 +02:00
parent f32e7957b4
commit 0af27f1f2a
1 changed files with 4 additions and 7 deletions

View File

@ -26,12 +26,9 @@ if(MSVC_C_ARCHITECTURE_ID AND CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPIL
file(WRITE ${showdir}/foo.h "\n")
file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n")
execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c
WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE showOut)
string(REPLACE main.c "" showOut1 ${showOut})
string(REPLACE "/" "\\" header1 ${showdir}/foo.h)
string(TOLOWER ${header1} header2)
string(REPLACE ${header2} "" showOut2 ${showOut1})
string(REPLACE "\n" "" showOut3 ${showOut2})
WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine)
string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}")
set(localizedPrefix "${CMAKE_MATCH_1}")
set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")")
set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${showOut3}\")")
set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${localizedPrefix}\")")
endif()