浏览代码

BUG: fix cmake so that if you configure with a bad env for cl, then with a good path, it will configure correctly

Bill Hoffman 16 年之前
父节点
当前提交
ad113d4df2
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 5 0
      Modules/CMakeTestCCompiler.cmake
  2. 5 0
      Modules/CMakeTestCXXCompiler.cmake

+ 5 - 0
Modules/CMakeTestCCompiler.cmake

@@ -29,6 +29,11 @@ IF(NOT CMAKE_C_COMPILER_WORKS)
   FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
   FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
     "Determining if the C compiler works failed with "
     "Determining if the C compiler works failed with "
     "the following output:\n${OUTPUT}\n\n")
     "the following output:\n${OUTPUT}\n\n")
+  # if the compiler is broken make sure to remove the platform file
+  # since Windows-cl configures both c/cxx files both need to be removed
+  # when c or c++ fails
+  FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake )
+  FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
   MESSAGE(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" "
   MESSAGE(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" "
     "is not able to compile a simple test program.\nIt fails "
     "is not able to compile a simple test program.\nIt fails "
     "with the following output:\n ${OUTPUT}\n\n"
     "with the following output:\n ${OUTPUT}\n\n"

+ 5 - 0
Modules/CMakeTestCXXCompiler.cmake

@@ -19,6 +19,11 @@ ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
 
 
 IF(NOT CMAKE_CXX_COMPILER_WORKS)
 IF(NOT CMAKE_CXX_COMPILER_WORKS)
   MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- broken")
   MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- broken")
+  # if the compiler is broken make sure to remove the platform file
+  # since Windows-cl configures both c/cxx files both need to be removed
+  # when c or c++ fails
+  FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake )
+  FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
   FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
   FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
     "Determining if the CXX compiler works failed with "
     "Determining if the CXX compiler works failed with "
     "the following output:\n${OUTPUT}\n\n")
     "the following output:\n${OUTPUT}\n\n")