There is more

Checks of the type outlined in this recipe are not always bulletproof and can generate both false positives and false negatives. As an example, you can try to comment out the lines containing CMAKE_REQUIRED_LIBRARIES and the example will still report "Success". The reason for this is that OpenMP pragmas will then be ignored by the compiler.

What should you do when you suspect that a wrong result is being returned? The CMakeOutput.log and CMakeError.log files in the CMakeFiles subdirectory of the build directory offer clues as to what went wrong. They report the standard output and standard error for operations run by CMake. If you suspect false positives, you should check the former, by searching for the variable set to hold ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.