diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 3d44ae8626..567ce3b280 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -3,7 +3,6 @@ #include "cmLocalVisualStudio7Generator.h" #include -#include #include #include #include @@ -1681,17 +1680,19 @@ bool cmLocalVisualStudio7Generator::WriteGroup( // Loop through each source in the source group. for (cmSourceFile const* sf : sourceFiles) { + // We only need source group members that are part of this target. + auto si = sources.Index.find(sf); + if (si == sources.Index.end()) { + continue; + } + std::string source = sf->GetFullPath(); if (source != libName || target->GetType() == cmStateEnums::UTILITY || target->GetType() == cmStateEnums::GLOBAL_TARGET || target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - // Look up the source kind and configs. - auto map_it = sources.Index.find(sf); - // The map entry must exist because we populated it earlier. - assert(map_it != sources.Index.end()); cmGeneratorTarget::AllConfigSource const& acs = - sources.Sources[map_it->second]; + sources.Sources[si->second]; FCInfo fcinfo(this, target, acs, configs); diff --git a/Tests/FortranC/CMakeLists.txt b/Tests/FortranC/CMakeLists.txt index 0c7d9c3200..59493e71d0 100644 --- a/Tests/FortranC/CMakeLists.txt +++ b/Tests/FortranC/CMakeLists.txt @@ -3,7 +3,7 @@ project(FortranC C Fortran) # Skip this test for compilers not known to be compatible. if(NOT (CMAKE_C_COMPILER_ID STREQUAL CMAKE_Fortran_COMPILER_ID OR - "${CMAKE_C_COMPILER_ID}-${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(MSVC-Intel|(GNU|Clang)-(LLVMFlang|LFortran))$")) + "${CMAKE_C_COMPILER_ID}-${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(MSVC-(Intel|IntelLLVM)|(GNU|Clang)-(LLVMFlang|LFortran))$")) message(STATUS "${CMAKE_C_COMPILER_ID} C and ${CMAKE_Fortran_COMPILER_ID} Fortran not known to be compatible!") return() endif() diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index d181ad5f66..a0c299dc20 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -200,7 +200,9 @@ if(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF AND endif() # Test that we are safe from infinite include recursion in dependency scanner -# (SunPro Fortran compiler does not support recursive inclusion) -if (NOT CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro") +if (# The SunPro Fortran compiler does not support recursive inclusion + NOT CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" + # The Intel Fortran VS integration overflows its stack. + AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") add_executable(test_include_loop test_include_loop.F) endif()