I recently struggled with the command CheckIncludeFile (and siblings) while
working with a custom toolchain.
Even if I was setting the necessary CMAKE_SYSROOT, include_directories and
even CMAKE_REQUIRED_INCLUDES, the commands would report a given header was
not found.

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.

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.

What's your opinion about this? What would be the best option? Option a)
seems to have the advantage of being extremely easy to implement, although
might introduce some overhead.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to