[cmake-developers] [CMake 0016092]: Module CheckIncludeFile should notify in case of compiler flag errors

Mantis Bug Tracker mantis at public.kitware.com
Tue May 3 05:10:32 EDT 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=16092 
====================================================================== 
Reported By:                Antonio
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   16092
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-05-03 05:10 EDT
Last Modified:              2016-05-03 05:10 EDT
====================================================================== 
Summary:                    Module CheckIncludeFile should notify in case of
compiler flag errors
Description: 
(Problem was first mentioned in mailing list 2 weeks ago, although there was no
feedback)

CheckIncludeFile will return "header not found" if some wrong compiler flags is
set (not accepted by the compiler).

I noticed the problem when having a "check include" failure even if I was
certain the include file should be found in the include paths I had set.
When I hacked into:
CheckIncludeFile.cmake
this line:
message(STATUS "OUTPUT=${OUTPUT}")
it turned out the problem was not in including file, but in the flags that
were passed to the compiler, causing a failure that the module interprets as
"the header could not be found".

I think an error message should be printed instead in this case.
This could be handled in 2 ways:
a) Either checking first of all if, with the given flags, the compiler will
succeed in compiling a source file containing JUST an empty main function.
For efficiency, this check might even be done AFTER the first try_compile
fails.
b) Or, in case of failure, checking that the error returned is JUST the
cannot find error message.

Option a) seems to have the advantage of being extremely easy to implement,
although might introduce some overhead.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-05-03 05:10 Antonio        New Issue                                    
======================================================================



More information about the cmake-developers mailing list