Since commit v3.3.0-rc1~397^2 (Check*CompilerFlag: Refactor method used
to pass flags, 2015-02-24) these check modules pass the flags to the
compiler front-end during linking as well as during compilation. This
breaks checks for flags like '-x c++' that are meant only for the
compilation step. Revert the change and add a test covering a
compiler-only flag.
Refactor the Check*CompilerFlag modules to pass the flags to
Check*SourceCompiles using CMAKE_REQUIRED_FLAGS instead of
CMAKE_REQUIRED_DEFINITIONS. Both end up being used, but the variable
for "FLAGS" is more precise.
This simplifies maintenance as most patterns will be for both modules and may
be added at a central place.
While at it add error patterns for XL and BCC.
Set the locale to C while running the compiler for these checks because
we match the resulting warning messages in English only.
Suggested-by: Marco Nolden <m.nolden@dkfz-heidelberg.de>
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block. This is no longer the preferred style.
Run the following shell code:
for c in else endif endforeach endfunction endmacro endwhile; do
echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
On Apple's gcc, the compiler emits a warning such as "warning: command
line option "-Wno-deprecated" is valid for C++/ObjC++ but not for C"
when it is passed that flag on its command line.
When testing for that flag with a plain C file, we should report that
the flag is unsupported for C files. The new FAIL_REGEX option added
here produces this behavior.
Use "int main(void)" instead of just "int main()" so that compiling with
"gcc -Werror=strict-prototypes" works. Test this check using the flags
"-Werror -Wstrict-prototypes" to work with old GCC versions.
This adds copyright/license notification blocks CMake's non-find
modules. Most of the modules had no notices at all. Some had notices
referring to the BSD license already. This commit normalizes existing
notices and adds missing notices.
These compilers warn and return 0 for unrecognized flags. We fix the
compiler flag check macros by looking for a warning in the output. We
also update the regex for GNU on older Macs. See issue #9516.
This compiler warns and returns 0 for unrecognized flags. We fix the
compiler flag check macros by looking for a warning in the output.
See issue #9516.
These compilers warn and return 0 for unrecognized flags. We fix the
compiler flag check macros by looking for a warning in the output.
See issue #9516.
This commit improves formatting and style of the documentation for the
general-purpose compiler check macros:
CHECK_C_COMPILER_FLAG
CHECK_C_SOURCE_COMPILES
CHECK_C_SOURCE_RUNS
CHECK_CXX_COMPILER_FLAG
CHECK_CXX_SOURCE_COMPILES
CHECK_CXX_SOURCE_RUNS
This sytle is more consistent with CMake command documentation.
It also looks nicer in the generated documentation text files.