refactor(cmake): replace CheckC/CXXCompilerFlag with CheckCompilerFlag#2092
Open
refactor(cmake): replace CheckC/CXXCompilerFlag with CheckCompilerFlag#2092
Conversation
Drop the local copies of CheckCCompilerFlag.cmake and CheckCXXCompilerFlag.cmake, which were redundant overrides of CMake built-in modules. In CodeCoverage.cmake, replace the two language-specific includes and calls with the unified CheckCompilerFlag module (introduced in CMake 3.19), consistent with the project's cmake_minimum_required of 3.30: - include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(...) - include(CheckCCompilerFlag) + check_c_compiler_flag(...) become: - include(CheckCompilerFlag) [once, shared by both blocks] - check_compiler_flag(CXX ...) - check_compiler_flag(C ...)
Drop three legacy CMake module files that are no longer referenced anywhere in the build system: - src/cmake/FindSSE.cmake SSE/AVX detection is handled by Eigen and the compiler directly. Compiler flag checking is now done via the built-in CheckCompilerFlag module (CMake 3.19+) in CodeCoverage.cmake.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Remove two redundant local CMake module overrides and modernize the
compiler flag detection in
CodeCoverage.cmaketo use the unifiedCheckCompilerFlagmodule.Changes
Deleted
src/cmake/CheckCCompilerFlag.cmakesrc/cmake/CheckCXXCompilerFlag.cmakeThese files were local copies of CMake built-in modules. Having them in
src/cmake/(which is onCMAKE_MODULE_PATH) caused them to shadow theofficial CMake versions, leading to potential silent regressions on newer
CMake releases.
Modified —
src/cmake/CodeCoverage.cmakeReplaced the two language-specific includes:
with the unified module available since CMake 3.19:
Motivation
Aligns with the
cmake_minimum_required(VERSION 3.30)already set inthe project.
CheckCompilerFlagis the modern, language-agnosticsuccessor to the deprecated per-language variants, and also supports
CUDA, HIP and Fortran with the same syntax.