summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeClDeps.cmake
diff options
context:
space:
mode:
authorPeter Kuemmel <syntheticpp@gmx.net>2012-06-08 20:01:57 (GMT)
committerPeter Kuemmel <syntheticpp@gmx.net>2012-06-08 20:59:18 (GMT)
commit941afa571c9f45c52bb935bad1c3b83fe415372e (patch)
tree85aeed7ac4e10f7404414d17316cf05670ed9516 /Modules/CMakeClDeps.cmake
parent033a687acd828ad6667d154939ffdbc482ab047f (diff)
downloadCMake-941afa571c9f45c52bb935bad1c3b83fe415372e.zip
CMake-941afa571c9f45c52bb935bad1c3b83fe415372e.tar.gz
CMake-941afa571c9f45c52bb935bad1c3b83fe415372e.tar.bz2
Ninja: allow spaces in source path
And make /showIncude prefix visible for all build rules
Diffstat (limited to 'Modules/CMakeClDeps.cmake')
-rw-r--r--Modules/CMakeClDeps.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake
new file mode 100644
index 0000000..435a6c5
--- /dev/null
+++ b/Modules/CMakeClDeps.cmake
@@ -0,0 +1,14 @@
+IF(MSVC_C_ARCHITECTURE_ID AND CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER)
+ FIND_PROGRAM(CMAKE_CMCLDEPS_EXECUTABLE NAMES cmcldeps.exe)
+ SET(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes)
+ 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})
+ SET(CMAKE_CL_SHOWINCLUDE_PREFIX ${showOut3} CACHE STRING "cl.exe's /showInclides prefix" FORCE)
+ENDIF()