Commit Graph

48 Commits

Author SHA1 Message Date
Alex Turbov
7b2dd9dedc
Refactor: Use added message types in various modules
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2019-11-02 14:10:09 +02:00
Marc Chevrier
f266182aec Check* functions family: add support for LINK_OPTIONS
Fixes: #18521
2018-12-01 17:56:23 +01:00
Kitware Robot
df4ed1e9ff Help: Convert remaining modules to block-style comments 2018-10-22 11:09:34 -04:00
Brad King
a61ae3fb80 CheckIncludeFiles: Honor CMAKE_REQUIRED_LIBRARIES
Other check modules honor this variable, so include file checks should
too.  Add policy `CMP0075` to enable the behavior in a compatible way.

This change was originally made by commit v3.11.0-rc1~108^2
(CheckIncludeFiles: Honor CMAKE_REQUIRED_LIBRARIES, 2017-12-24) but it
was reverted by commit v3.11.1~9^2 (Revert "CheckIncludeFiles: Honor
CMAKE_REQUIRED_LIBRARIES", 2018-04-04) because the behavior change could
affect checks in existing projects in an incompatible way.

Fixes: #9514
2018-04-18 08:09:56 -04:00
Brad King
35109e718b Revert "CheckIncludeFiles: Honor CMAKE_REQUIRED_LIBRARIES"
This reverts commit v3.11.0-rc1~108^2 (CheckIncludeFiles: Honor
CMAKE_REQUIRED_LIBRARIES, 2017-12-24).  The behavior change can
affect checks in existing projects that don't expect the behavior.
Introducing the behavior again will require a policy.

Fixes: #17874
Issue: #9514
2018-04-04 13:14:01 -04:00
Don Hinton
f74c25802d CheckIncludeFiles: Honor CMAKE_REQUIRED_LIBRARIES
This is needed when cross compiling and the compiler requires a specific
linker different from the default, e.g., when cross compiling from
Darwin to Linux and passing `-fuse-ld=lld` to clang.

Fixes: #9514
2018-01-10 14:13:32 -05:00
Brad King
d5681e353a Merge topic 'pragma-once'
4d611868 Check*: Added include guards

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1327
2017-12-04 10:52:47 -05:00
Cristian Adam
4d611868df Check*: Added include guards 2017-12-01 13:05:02 +02:00
Brad King
3eee33012e CheckIncludeFiles: Fix name of source file used for check
In commit 7669695a74 (CheckIncludeFiles: extend to allow a LANGUAGE
argument, 2017-11-08) the file name used for the check was accidentally
left as `${var}.c`, where `var` is not a variable we define.  It was
passing tests by accidentally using just `.c` as the file name, but can
break in real projects that may leave `var` defined to something else.
The reference was taken from similar code in CheckTypeSize where the
variable names are different.  Fix our reference to be `${VARIABLE}`.
2017-11-30 07:37:35 -05:00
David Adam
b31d5e1dfd CheckIncludeFiles: improve warning for missing argument 2017-11-24 15:54:00 +08:00
David Adam
1f1c2a9fdf CheckIncludeFiles: clean up documentation of new features 2017-11-24 15:53:54 +08:00
David Adam
7669695a74 CheckIncludeFiles: extend to allow a LANGUAGE argument
Allows CheckIncludeFiles to work for C or C++.
2017-11-11 23:02:30 +08:00
Brad King
86578eccf2 Simplify CMake per-source license notices
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.
2016-09-27 15:14:44 -04:00
Daniel Pfeifer
5d0d980d99 Use string(APPEND) in Modules
Automate with:

find Modules -type f -print0 | xargs -0 perl -i -0pe \
's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
2016-07-28 00:41:13 +02:00
Brad King
81d58b0de6 Help: Revise CheckIncludeFile* documentation
Improve formatting.  Link from each module to the other two.  Explain
the command signatures in more detail.
2015-06-25 09:41:02 -04:00
Sebastian Leske
908c74399a Help: Document that the CHECK_* macros create cache variables
Otherwise callers may expect to be able to re-use result variables.
2014-09-11 08:55:26 -04:00
Nate Eldredge
bf89f91034 CheckIncludeFiles: Use modern C declaration for 'main' (#15058)
Otherwise some compilers will incorrectly fail the checks when certain
warning/error flags are enabled.
2014-08-05 09:09:58 -04:00
Brad King
4f2fcce4b9 Check*: Allow result variables to contain regex special characters (#14923)
Prior to the existence of the if(DEFINED) condition, many of our Check
modules implemented the condition with a hack that takes advantage of
the auto-dereference behavior of the if() command to detect if a
variable is defined.  The hack has the form:

 if("${VAR} MATCHES "^${VAR}$")

where "${VAR}" is a macro argument reference.  However, this does not
work when the variable named in the macro argument contains characters
that have special meaning in regular expressions, such as '+'.  Run the
command

 git grep -E 'if\("\$\{.*\}" MATCHES "\^\$\{.*\}\$"\)' -- Modules/Check*

to identify lines with this problem.  Use if(NOT DEFINED) instead.
2014-07-31 09:48:41 -04:00
Clinton Stimpson
4c0cc9ab91 Check*.cmake : Add CMAKE_REQUIRED_QUIET flag.
Setting this flag can silence messages from the Check*.cmake modules.
This can be used by Find*.cmake modules when they are in silent mode.
2014-03-29 20:14:23 -06:00
Daniele E. Domenichelli
15610bb5b1 Drop use of configure_file IMMEDIATE option
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
2013-11-13 10:12:17 -05:00
Kitware Robot
f051814ed0 Convert builtin help to reStructuredText source files
Run the convert-help.bash script to convert documentation:

 ./convert-help.bash "/path/to/CMake-build/bin"

Then remove it.
2013-10-15 14:12:03 -04:00
Stephen Kelly
4ad02332aa Remove period at the end of the check message.
Other messages don't have one.
2012-09-29 18:44:41 +02:00
Kitware Robot
9db3116226 Remove CMake-language block-end command arguments
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
2012-08-13 14:19:16 -04:00
Kitware Robot
77543bde41 Convert CMake-language commands to lower case
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
2012-08-13 14:19:16 -04:00
Kitware Robot
7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Brad King
5adb6b7a34 CheckIncludeFiles: Shorten check description message
Since commit 44d007b6 (CheckIncludeFiles: fix status output, 2012-02-01)
check_include_files reports the list of files tested instead of the name
of the variable storing the result.  Some projects incrementally test
and concatenate very long lists leading to long messages that do not
provide much information.  Users report confusion especially when the
lines wrap.

For lists of more than two files produce messages of the format

 Looing for N include files first.h, ..., last.h

where N is the list length and "..." is literal.  Leave the log file
entries and cache entry description unchanged as they should have the
full detail of the check performed.
2012-04-09 15:57:02 -04:00
Rolf Eike Beer
44d007b659 CheckIncludeFiles: fix status output
CHECK_INCLUDE_FILES("foo.h" HAVE_FOO_H) gave an output like:

  Looking for include files HAVE_FOO_H

After this change it does now what CHECK_INCLUDE_FILE() also does:

  Looking for include files foo.h
2012-02-01 18:14:52 +01:00
Todd Gamblin
2cde67a781 Modules: Fix spelling 'To distributed' -> 'To distribute' 2010-08-09 08:48:31 -04:00
Brad King
3a666595c9 Convert CMake non-find modules to BSD License
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.
2009-09-28 11:46:51 -04:00
Bill Hoffman
1871f06ad6 BUG: fix double cmakefiles directory 2008-02-17 17:40:01 -05:00
Ken Martin
8e9a6beccc ENH: centralized locaiton of CMakeFiles setting 2006-06-14 12:28:32 -04:00
Andy Cedilnik
743b4c9983 BUG: Fix the module 2006-02-24 09:08:03 -05:00
Andy Cedilnik
01a55559dd ENH: Make modules use configure instead of file write 2006-02-23 09:58:07 -05:00
Brad King
f0a1da00c1 ENH: Made Check* modules more consistent and well documented. Added CMAKE_REQUIRED_DEFINITIONS option. 2006-02-09 19:23:18 -05:00
Brad King
c90b8d0537 ENH: Patch from Alexander Neundorf to improve behavior. 2006-02-09 13:14:57 -05:00
Ken Martin
4bdca3b404 ENH: put CmakeTmp into CMakeFiles 2006-01-12 13:49:32 -05:00
Ken Martin
d2689c95a1 ENH: some style fixes for the book 2005-12-15 10:41:19 -05:00
Bill Hoffman
b7fa820118 ENH: add documentation support for modules 2005-12-14 13:51:08 -05:00
Ken Martin
0a5b9db60b DOC: better documentaiton 2005-11-02 13:51:59 -05:00
Ken Martin
c6b011e35e ENH: put cmake files intoa CMakeFiles subdir to clean up bin tree 2005-07-29 09:19:25 -04:00
Andy Cedilnik
b1a1526e14 ENH: When test fails, write out the output 2004-10-05 08:32:08 -04:00
Andy Cedilnik
8149dbed29 ENH: Cleanups and add missing CMakeOutput.log and CMakeError.log appending. Close Bug #136 - Verify that all modules that do try compile produce CMakeError.log and CMakeOutput.log 2003-08-08 11:59:07 -04:00
Andy Cedilnik
d6ebc123f7 ENH: Extra new line after output 2003-07-17 14:55:45 -04:00
Andy Cedilnik
a17587c244 ENH: Replace WRITE_FILE with FILE(WRITE and FILE(APPEND. Replace MAKE_DIRECTORY with FILE(MAKE_DIRECTORY, replace STRING(ASCII things 2003-07-11 14:14:03 -04:00
Andy Cedilnik
eb5fe7990a ERR: Remove warning for main returning void. 2003-05-05 09:54:55 -04:00
Andy Cedilnik
6c9d1983d7 This list can be really long. Only display the variable name 2003-01-21 14:01:41 -05:00
Andy Cedilnik
e720b84d6b Add required flags 2003-01-03 19:23:19 -05:00
Andy Cedilnik
de00883c41 Add macro for checking if a swequence of includes can be includes 2003-01-01 18:00:49 -05:00