Remove dead MSVC version fallbacks in CGAL_GeneratorSpecificSettings.cmake#9394
Conversation
There was a problem hiding this comment.
Pull request overview
This PR simplifies CGAL’s generator/toolset detection logic by removing legacy MSVC version fallback branches that are no longer relevant given CGAL’s current CMake/C++ requirements.
Changes:
- Removed the
elseif(MSVC14)…elseif(MSVC71)fallback chain fromCGAL_GeneratorSpecificSettings.cmake. - Kept non-MSVC status reporting by changing the final branch to
elseif(NOT MSVC).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| set(CGAL_TOOLSET "vc71") | ||
| message( STATUS "Using VC71 compiler." ) | ||
| else() | ||
| elseif ( NOT MSVC ) |
There was a problem hiding this comment.
With this change, if MSVC is true but MSVC_TOOLSET_VERSION is not set/empty, the script now produces no status output and leaves CGAL_TOOLSET unset (previously it would at least hit the else() message). If the intent is to rely on cmake_minimum_required(VERSION 3.15...) guaranteeing MSVC_TOOLSET_VERSION, consider adding an explicit elseif(MSVC) branch that errors or emits a clear diagnostic so unexpected toolchains/CMake versions fail loudly instead of silently skipping compiler/toolset reporting.
| elseif ( NOT MSVC ) | |
| elseif ( MSVC ) | |
| message(AUTHOR_WARNING | |
| "MSVC is detected but MSVC_TOOLSET_VERSION is not set. " | |
| "This may indicate an unsupported CMake version or toolchain; " | |
| "compiler/toolset reporting and CGAL_TOOLSET configuration may be incomplete.") | |
| else() |
…cmake Remove the dead elseif(MSVC14) through elseif(MSVC71) fallback chain. These are unreachable because CGAL requires CMake >= 3.15, which always defines MSVC_TOOLSET_VERSION for any MSVC build. Additionally, CGAL requires C++17, which needs VS 2017+ at minimum. Add an explicit elseif(MSVC) branch with AUTHOR_WARNING for the edge case where MSVC is detected but MSVC_TOOLSET_VERSION is unexpectedly empty, so it fails loudly instead of silently skipping toolset config. The else() branch preserves the status message for non-MSVC compilers.
a26ec2e to
7be47bb
Compare
Summary of Changes
Remove the dead
elseif(MSVC14)throughelseif(MSVC71)fallback chain inInstallation/cmake/modules/CGAL_GeneratorSpecificSettings.cmake.These fallbacks targeted Visual Studio 2003 (VC 7.1) through Visual Studio 2015 (VC14). They are unreachable dead code because:
CGAL requires CMake >= 3.15, and
MSVC_TOOLSET_VERSIONhas been defined for all MSVC versions since CMake 3.12. Theif(MSVC_TOOLSET_VERSION)branch always fires for any MSVC build, making theelseifchain unreachable.CGAL requires C++17, which means Visual Studio 2017 (15.3) at minimum. None of the removed fallback versions (VS 2003–2015) can compile CGAL.
The
else()branch (non-MSVC compilers) is preserved aselseif(NOT MSVC)to maintain the status message for GCC/Clang/etc.Before:
After:
Release Management
Installation