Skip to content

Mark includes of eigen3 headers as SYSTEM in CMakeLists.txt#570

Merged
ChrisJChang merged 2 commits into
masterfrom
build/mark_eigen3_include_as_system
Apr 21, 2026
Merged

Mark includes of eigen3 headers as SYSTEM in CMakeLists.txt#570
ChrisJChang merged 2 commits into
masterfrom
build/mark_eigen3_include_as_system

Conversation

@pstoecker

Copy link
Copy Markdown
Member

This addresses our quite complex workaround to silence compiler warnings originating from external packages such as eigen3.

We have silenced the warnings by wrapping the include statements for eigen3 headers between the headers begin_ignore_warnings_eigen.hpp and end_ignore_warnings.hpp and every "annoying" compiler warning is explicitly stated in there.

CMake actually offers a cleaner solution for this. In the include_directories function, one can pass the SYSTEM keyword (cf. CMake docs - target_include_directories). This will tell the compiler (if supported) to treat these headers as system header and warnings originating from code in their is suppressed.

This PR sets the SYSTEM keyword for the Eigen3 library and deletes the begin_ignore_warnings_eigen.hpp and its usages. I have tested it with clang and there are no compiler warnings related to eigen3 code. I am not sure though how good this solution works with intel compilers.

I guess that similar improvements could be made for the other external packages, such as pybind11 in which we silence the warnings in the same fashion.

 * This will tell the compiler that Eigen3 headers are external and compiler warnings originating from there are silenced

	modified:       CMakeLists.txt
 * This header is not needed anymore as compiler wanrings originating from eigen3 are silenced as per the previous commit

	modified:       Backends/include/gambit/Backends/backend_types/gm2calc_1_2_0/loaded_types.hpp
	modified:       Backends/include/gambit/Backends/backend_types/gm2calc_1_3_0/loaded_types.hpp
	modified:       Backends/scripts/BOSS/configs/gm2calc_1_2_0.py
	modified:       Backends/scripts/BOSS/configs/gm2calc_1_3_0.py
	modified:       ColliderBit/include/gambit/ColliderBit/analyses/AnalysisData.hpp
	modified:       ColliderBit/include/gambit/ColliderBit/analyses/SignalRegionData.hpp
	modified:       ColliderBit/src/LHC_likelihoods.cpp
	modified:       ColliderBit/src/analyses/Analysis_ATLAS_13TeV_0LEP_139invfb.cpp
	modified:       ColliderBit/src/analyses/Analysis_ATLAS_13TeV_0LEP_13invfb.cpp
	modified:       ColliderBit/src/analyses/Analysis_ATLAS_13TeV_0LEP_36invfb.cpp
	modified:       DarkBit/src/Axions.cpp
	modified:       NeutrinoBit/include/gambit/NeutrinoBit/NeutrinoBit_rollcall.hpp
	modified:       NeutrinoBit/src/NeutrinoBit.cpp
	modified:       ScannerBit/include/gambit/ScannerBit/py_module.hpp
	modified:       ScannerBit/include/gambit/ScannerBit/python_utils.hpp
	removed:        Utils/include/gambit/Utils/begin_ignore_warnings_eigen.hpp
@ChrisJChang

Copy link
Copy Markdown
Collaborator

This works for my build, but I do not compile with Intel. If anyone does, would be great if they could try this and see if it works.

@ChrisJChang ChrisJChang requested a review from patscott February 3, 2026 10:15
@ChrisJChang

Copy link
Copy Markdown
Collaborator

I'm going to merge this since I think it is unlikely to break anything.

@ChrisJChang ChrisJChang self-requested a review April 21, 2026 08:21
@ChrisJChang ChrisJChang removed the request for review from patscott April 21, 2026 08:22
@ChrisJChang ChrisJChang merged commit 4d3e0b9 into master Apr 21, 2026
0 of 11 checks passed
@ChrisJChang ChrisJChang deleted the build/mark_eigen3_include_as_system branch April 21, 2026 08:22
@patscott

Copy link
Copy Markdown
Member

apologies for not getting to this guys...

@anderkve

Copy link
Copy Markdown
Collaborator

No worries at all! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants