Selaa lähdekoodia

Merge topic 'compiler-id-msvc-no-lib' into release-3.21

e93245ec64 DetermineCompiler: Restore identification of MSVC with no INCLUDE or LIB

Acked-by: Kitware Robot <[email protected]>
Merge-request: !6295
Brad King 4 vuotta sitten
vanhempi
sitoutus
da48ee53ae

+ 2 - 1
Modules/CMakeDetermineCCompiler.cmake

@@ -88,7 +88,8 @@ else()
 
     # MSVC needs at least one include directory for __has_include to function,
     # but custom toolchains may run MSVC with no INCLUDE env var and no -I flags.
-    "-I__does_not_exist__"
+    # Also avoid linking so this works with no LIB env var.
+    "-c -I__does_not_exist__"
     )
 endif()
 if(CMAKE_C_COMPILER_TARGET)

+ 2 - 1
Modules/CMakeDetermineCXXCompiler.cmake

@@ -83,7 +83,8 @@ else()
 
     # MSVC needs at least one include directory for __has_include to function,
     # but custom toolchains may run MSVC with no INCLUDE env var and no -I flags.
-    "-I__does_not_exist__"
+    # Also avoid linking so this works with no LIB env var.
+    "-c -I__does_not_exist__"
     )
 endif()