summaryrefslogtreecommitdiff
path: root/Modules/CheckCCompilerFlag.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'doc_varreq'Brad King2023-03-161-11/+23
|\ | | | | | | | | | | | | | | 9e1b30121f Help:toolchain: refer to CheckSourceCompiles cf48022dc5 Help:Check*: include CMAKE_REQUIRED_* vars to dedupe Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8300
| * Help:Check*: include CMAKE_REQUIRED_* vars to dedupescivision2023-03-141-11/+23
| | | | | | | | | | | | CMAKE_REQUIRED_FLAGS now notes that space-delimited string, not ;-list is required, which could be surprising compared to similar options that do use ;-list
* | Modules:Check,GenerateExportHeader: include only what's neededscivision2023-03-131-1/+0
|/ | | | | | GenerateExportHeader had a hidden state requirement that other modules were included first. Considering include_guard, Modules should include all they actually use.
* Modules: Do not implicitly add new functions via old Check ModulesRobert Maynard2020-10-261-2/+2
| | | | | | | | | | | | | The conversion of Check<Lang>CompilerFlag, SourceCompiles, and SourceRuns over to the new functions has the possibility of breaking projects that had functions with those existing names. To reduce the possibility of collisions we now have all the legacy code call functions that start with `cmake_`, and users will need to explicitly include the new modules to get the non-prefixed versions Fixes: #21359
* CheckCompilerFlag: unified way to check compiler flags per languageRobert Maynard2020-09-281-21/+5
|
* Check*CompilerFlag: Do not set result as a normal variable tooBrad King2020-09-211-1/+0
| | | | | | | | | Refactoring in commit cb984c6627 (Check*CompilerFlag: Modernize modules, 2019-12-09, v3.17.0-rc1~320^2) accidentally left the result set as a normal variable in addition to as a cache entry. This is not specified by the documentation, and is not the behavior in CMake 3.16 and below. Fixes: #21207
* Check*CompilerFlag: Modernize modulesAlexander Grund2019-12-091-19/+14
| | | | | | - User lower-case names - Wrap in function instead of macro to avoid set-unset calls - Use IN LISTS for foreach
* Modules: Consistently use 2 space indentationKitware Robot2019-05-141-21/+21
|
* Help: Revise docs of modules AddFileDependencies..CheckFunctionExistsJoachim Wuttke (l)2018-10-191-1/+1
| | | | | | * Replace '::' by '.. code-block:: cmake' wherever it makes sense. * Convert to definition list where appropriate. * Prefer '<placeholder>' over 'placeholder'.
* Check*: Added include guardsCristian Adam2017-12-011-0/+1
|
* Check*CompilerFlag: Rewrite documentation of these modulesBrad King2017-06-151-20/+30
| | | | | | | | Format with modern markup. Clarify that the setting of `CMAKE_REQUIRED_DEFINITIONS` is temporary. Add a note warning about contamination of the checks by `CMAKE_<LANG>_FLAGS`. Issue: #16973
* Simplify CMake per-source license noticesBrad King2016-09-271-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Check*CompilerFlag: Revert to previous method used to pass flags (#15641)Brad King2015-07-081-4/+4
| | | | | | | | | 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.
* Check*CompilerFlag: Refactor method used to pass flagsMark Abraham2015-02-241-4/+4
| | | | | | | 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.
* Help: Document that the CHECK_* macros create cache variablesSebastian Leske2014-09-111-0/+1
| | | | Otherwise callers may expect to be able to re-use result variables.
* Convert builtin help to reStructuredText source filesKitware Robot2013-10-151-10/+18
| | | | | | | | Run the convert-help.bash script to convert documentation: ./convert-help.bash "/path/to/CMake-build/bin" Then remove it.
* Check*CompilerFlag: make C and CXX modules share most error patterns (#14339)Rolf Eike Beer2013-08-131-11/+5
| | | | | | | 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.
* CheckC*CompilerFlag: add documentation what to expect from a positive resultRolf Eike Beer2013-08-131-0/+3
|
* Check*CompilerFlag: Document use of CMAKE_REQUIRED_DEFINITIONS (#14309)Brad King2013-07-251-2/+3
| | | | | Explain how CMAKE_REQUIRED_DEFINITIONS is set before calling the check_*_source_compiles macros.
* Check{C,CXX}CompilerFlag: Test using C locale (#14102)Brad King2013-04-221-0/+12
| | | | | | | 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>
* Remove CMake-language block-end command argumentsKitware Robot2012-08-131-1/+1
| | | | | | | | | | | | | | | | | 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
* Convert CMake-language commands to lower caseKitware Robot2012-08-131-6/+6
| | | | | | | | | | | | | | | | | Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Check{C,CXX}CompilerFlag: catch more Intel warning types (#12576)Rolf Eike Beer2012-04-271-1/+3
| | | | Patch provided by Szilárd Páll.
* Check{C,CXX}CompilerFlag: detect ICC error messagesRolf Eike Beer2012-02-231-0/+1
| | | | Patch provided by Christopher Sean Morrison.
* Improve checks for Open64 and g++ incompatible flags (#12119)Matthias Kretz2012-02-121-0/+2
|
* CheckCCompilerFlag: Generalize "but not for C" case (#12633)Brad King2011-12-221-3/+2
| | | | | The "warning: " part is not necessary. The case can happen on any GNU compiler, not just an Apple version.
* Fix CHECK_(C|CXX)_COMPILER_FLAG for Clang (#12394)Brad King2011-08-081-0/+1
| | | | | This compiler warns and returns 0 for unrecognized flags. We fix the compiler flag check macros by looking for a warning in the output.
* Add fail regex to detect supported warning flags correctly.David Cole2011-07-271-1/+2
| | | | | | | | | | 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.
* CheckCCompilerFlag: Strict signature of 'main' (#11615)Brad King2010-12-161-1/+1
| | | | | | 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.
* BUG: Fix compiler flag test for non-English MSVC (#11336)Brad King2010-11-041-1/+2
| | | | Approach suggested by John Stark.
* Modules: Fix spelling 'To distributed' -> 'To distribute'Todd Gamblin2010-08-091-1/+1
|
* Convert CMake non-find modules to BSD LicenseBrad King2009-09-281-4/+12
| | | | | | | 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.
* Fix CHECK_(C|CXX)_COMPILER_FLAG for XL and SunProBrad King2009-09-181-1/+3
| | | | | | 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.
* Fix CHECK_(C|CXX)_COMPILER_FLAG for HPBrad King2009-09-171-0/+1
| | | | | | 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.
* Fix CHECK_(C|CXX)_COMPILER_FLAG for GNU and MSVCBrad King2009-09-171-1/+5
| | | | | | 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.
* Cleanup generic compiler check macro documentationBrad King2009-09-171-8/+6
| | | | | | | | | | | | | | | 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.
* ENH: fix docs, bug 7590Bill Hoffman2008-09-091-0/+4
|
* ENH: two macros to check whether the C/CXX compiler supports a given flag:Alexander Neundorf2006-09-181-0/+21
CHECK_CXX_COMPILER_FLAG("-Wall" COMPILER_SUPPORTS_WALL) Alex