Pārlūkot izejas kodu

FortranCInterface: Fix support for VS with Intel toolset

When using a Visual Studio generator with an Intel toolset, such as

    -T "Intel C++ Compiler XE 14.0"

the generated FortranCInterface mangling detection project may fail to
build due to `devenv` not working with the `/project ALL_BUILD` option.
This seems to be a bug in `devenv` or the Intel VS integration.  Work
around the problem by building with `/project FortranCInterface`
instead.  We only need to build this executable and its dependencies
within the detection test project anyway.

Fixes: #16519
Brad King 8 gadi atpakaļ
vecāks
revīzija
c9ee05d8d9

+ 2 - 1
Modules/FortranCInterface.cmake

@@ -348,7 +348,8 @@ function(FortranCInterface_VERIFY)
     try_compile(FortranCInterface_VERIFY_${lang}_COMPILED
       ${FortranCInterface_BINARY_DIR}/Verify${lang}
       ${FortranCInterface_SOURCE_DIR}/Verify
-      VerifyFortranC
+      VerifyFortranC # project name
+      VerifyFortranC # target name
       CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx}
                   -DCMAKE_VERBOSE_MAKEFILE=ON
                  "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"

+ 2 - 1
Modules/FortranCInterface/Detect.cmake

@@ -30,7 +30,8 @@ set(_result)
 try_compile(FortranCInterface_COMPILED
   ${FortranCInterface_BINARY_DIR}
   ${FortranCInterface_SOURCE_DIR}
-  FortranCInterface
+  FortranCInterface # project name
+  FortranCInterface # target name
   CMAKE_FLAGS
     "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
     "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"