summaryrefslogtreecommitdiffstats
path: root/Modules
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
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')
-rw-r--r--Modules/CMakeCCompiler.cmake.in5
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in5
-rw-r--r--Modules/CMakeClDeps.cmake14
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake4
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake1
-rw-r--r--Modules/Platform/Windows-cl.cmake18
6 files changed, 26 insertions, 21 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index b14cf34..7a17e18 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -48,3 +48,8 @@ SET(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@")
SET(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
SET(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@")
+
+IF(MSVC_CXX_ARCHITECTURE_ID)
+ SET(CMAKE_CMCLDEPS_EXECUTABLE "@CMAKE_CMCLDEPS_EXECUTABLE@")
+ SET(CMAKE_CL_SHOWINCLUDE_PREFIX "@CMAKE_CL_SHOWINCLUDE_PREFIX@")
+ENDIF()
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index bc3bc2e..49a54d0 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -49,3 +49,8 @@ SET(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@")
SET(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
SET(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
+
+IF(MSVC_CXX_ARCHITECTURE_ID)
+ SET(CMAKE_CMCLDEPS_EXECUTABLE "@CMAKE_CMCLDEPS_EXECUTABLE@")
+ SET(CMAKE_CL_SHOWINCLUDE_PREFIX "@CMAKE_CL_SHOWINCLUDE_PREFIX@")
+ENDIF()
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()
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index e2e268f..53f558e 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -165,9 +165,7 @@ ENDIF (CMAKE_CROSSCOMPILING
AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
AND NOT _CMAKE_TOOLCHAIN_PREFIX)
-
-
-
+INCLUDE(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake)
INCLUDE(CMakeFindBinUtils)
IF(MSVC_C_ARCHITECTURE_ID)
SET(SET_MSVC_C_ARCHITECTURE_ID
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 8298369..7f8f3ec 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -173,6 +173,7 @@ ENDIF (CMAKE_CROSSCOMPILING
AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+INCLUDE(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake)
INCLUDE(CMakeFindBinUtils)
IF(MSVC_CXX_ARCHITECTURE_ID)
SET(SET_MSVC_CXX_ARCHITECTURE_ID
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index eed4e52..be6abb6 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -251,21 +251,3 @@ IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE)
ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
-
-
-IF(CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER)
- # TODO try_compile doesn't need cmcldeps, find a better solution
- if(NOT EXISTS ${CMAKE_TRY_COMPILE_SOURCE_DIR}/../ShowIncludes)
- 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})
- ENDIF()
-ENDIF()