Commit Graph

50 Commits

Author SHA1 Message Date
Felix Geyer 49e82c15d5 Fix spelling typos in comments and documentation (#16037)
The Debian package checker tool (lintian) detected several typos in
CMake.
2016-03-29 14:31:02 -04:00
Rolf Eike Beer 0b38424cf2 FindThreads: make the call to try_run() work also if only C++ is enabled
This isn't enough to make the whole module work with only C++ enabled.
2015-09-25 10:08:05 -04:00
Rolf Eike Beer 9924a212f6 FindThreads: replace CheckIncludeFiles by CheckIncludeFile
While at it, also add a branch using CheckIncludeFileCXX. Also give a better
error message if no supported language is enabled. C++ support isn't working
yet, but it has never worked.
2015-09-25 10:08:05 -04:00
Rolf Eike Beer b7e5c5a23a FindThreads: introduce THREADS_PREFER_PTHREAD_FLAG (#14767) 2014-10-08 17:57:34 +02:00
Timo Rothenpieler bcb0e3872b FindThreads: introduce an imported target to link to
This not only holds the library, but can also hold compiler flags needed, e.g.
the -pthread flag preferred by gcc on some platforms. There was no clean way
to get that compiler flag from the module until now.
2014-10-08 17:57:34 +02:00
Rolf Eike Beer 46368eddfd FindThreads: move checking of the -pthread compiler flag into a macro
This allows a following commit to introduce a switch to prefer that check over
searching for the explicit library names without breaking backward
compatibility.
2014-10-06 21:30:09 +02:00
Brad King e0fef85c7a Merge topic 'FindThreads-macro'
94a061d3 FindThreads: use a macro for the repetitive thread library checks
2014-10-06 09:41:16 -04:00
Rolf Eike Beer 94a061d372 FindThreads: use a macro for the repetitive thread library checks 2014-10-03 23:20:07 +02:00
Timo Rothenpieler cbd5db6485 FindThreads: search test source relative to module
This is a simpler way to reference the location of FindThreads.cmake.
2014-10-02 22:13:44 +02:00
Rolf Eike Beer 3a71d34cf3 Use CMAKE_SYSTEM_NAME instead of CMAKE_SYSTEM where sufficient 2014-04-14 18:17:18 +02:00
Rolf Eike Beer b0b4b4602f Remove .* expressions from beginning and end of MATCHES regexs
All these expressions work the same:
  "foo"
  ".*foo.*"
  "^.*foo.*$"

This assumes that the "Intel*" expressions were meant to be "Intel.*".
2014-04-14 18:17:11 +02:00
Clinton Stimpson 83934757c9 Find*: Make find_package(.. QUIET) affect Check* modules.
Fixes issues #14812 and #14813 where find_package(OpenMP QUIET) and
find_package(Qt4 QUIET) would still print out messages when calling
check*() functions.

Also a partial fix for  #14445 where building CMake
(without cmake-gui) when Qt5 is installed and Qt4 is not installed
and warnings come out of FindQt4.cmake.
2014-03-29 20:22:54 -06:00
Rolf Eike Beer 693f8bf34d FindThreads: simplify checking for SunOS 2014-03-25 23:49:54 +01:00
Rolf Eike Beer 858ce31f4c FindThreads: avoid useless checks if a thread library is already found 2014-03-25 23:47:49 +01:00
Rolf Eike Beer fdf7bd27a3 FindThreads: replace MATCHES with STREQUAL 2014-03-25 22:46:11 +01: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
Rolf Eike Beer cd4451d1e7 replace string(... MATCHES "^const$) with string(... STREQUAL "const") 2013-06-02 22:18:19 +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
Rolf Eike Beer 3dc6f2bfb3 FindThreads: Try pthreads with no special option first (#11333)
QNX has the phtread stuff in the standard library.  The best way would
IMHO be to check if a program that uses pthread_* can be successfully
linked without specifying any linker option before trying out the
different flags.
2012-01-21 22:24:19 +01:00
David Cole 98c49a4a25 Revert "FindThreads: Try pthreads with no special option first (#11333)"
This reverts commit fd61be7140.
2011-09-20 18:40:22 -04:00
Rolf Eike Beer fd61be7140 FindThreads: Try pthreads with no special option first (#11333)
QNX has the phtread stuff in the standard library.  The best way would
IMHO be to check if a program that uses pthread_* can be successfully
linked without specifying any linker option before trying out the
different flags.
2011-08-20 14:36:34 -04:00
Brad King c4275592a8 Modules: Include builtin FindPackageHandleStandardArgs directly
The FindPackageHandleStandardArgs module was originally created outside
of CMake.  It was added for CMake 2.6.0 by commit e118a627 (add a macro
FIND_PACKAGE_HANDLE_STANDARD_ARGS..., 2007-07-18).  However, it also
proliferated into a number of other projects that at the time required
only CMake 2.4 and thus could not depend on CMake to provide the module.
CMake's own find modules started using the module in commit b5f656e0
(use the new FIND_PACKAGE_HANDLE_STANDARD_ARGS in some of the FindXXX
modules..., 2007-07-18).

Then commit d358cf5c (add 2nd, more powerful mode to
find_package_handle_standard_args, 2010-07-29) added a new feature to
the interface of the module that was fully optional and backward
compatible with all existing users of the module.  Later commit 5f183caa
(FindZLIB: use the FPHSA version mode, 2010-08-04) and others shortly
thereafter started using the new interface in CMake's own find modules.
This change was also backward compatible because it was only an
implementation detail within each module.

Unforutnately these changes introduced a problem for projects that still
have an old copy of FindPackageHandleStandardArgs in CMAKE_MODULE_PATH.
When any such project uses one of CMake's builtin find modules the line

  include(FindPackageHandleStandardArgs)

loads the copy from the project which does not have the new interface!
Then the including find module tries to use the new interface with the
old module and fails.

Whether this breakage can be considered a backward incompatible change
in CMake is debatable.  The situation is analagous to copying a standard
library header from one version of a compiler into a project and then
observing problems when the next version of the compiler reports errors
in its other headers that depend on its new version of the original
header.  Nevertheless it is a change to CMake that causes problems for
projects that worked with previous versions.

This problem was discovered during the 2.8.3 release candidate cycle.
It is an instance of a more general problem with projects that provide
their own versions of CMake modules when other CMake modules depend on
them.  At the time we resolved this instance of the problem with commit
b0118402 (Use absolute path to FindPackageHandleStandardArgs.cmake
everywhere, 2010-09-28) for the 2.8.3 release.

In order to address the more general problem we introduced policy
CMP0017 in commit db44848f (Prefer files from CMAKE_ROOT when including
from CMAKE_ROOT, 2010-11-17).  That change was followed by commit
ce28737c (Remove usage of CMAKE_CURRENT_LIST_DIR now that we have
CMP0017, 2010-12-20) which reverted the original workaround in favor of
using the policy.  However, existing project releases do not set the
policy behavior to NEW and therefore still exhibit the problem.

We introduced in commit a364daf1 (Allow users to specify defaults for
unset policies, 2011-01-03) an option for users to build existing
projects by adding -DCMAKE_POLICY_DEFAULT_CMP0017=NEW to the command
line.  Unfortunately this solution still does not allow such projects to
build out of the box, and there is no good way to suggest the use of the
new option.

The only remaining solution to keep existing projects that exhibit this
problem building is to restore the change originally made in commit
b0118402 (Use absolute path to FindPackageHandleStandardArgs.cmake
everywhere, 2010-09-28).  This also avoids policy CMP0017 warnings for
this particular instance of the problem the policy addresses.
2011-01-20 10:56:49 -05:00
Alex Neundorf ce28737c93 Remove usage of CMAKE_CURRENT_LIST_DIR now that we have CMP0017
This puts the new search behaviour for included files in action, i.e.
now when a file from Modules/ include()s another file, it also gets the
one from Modules/ included, i.e. the one it expects.

Alex
2011-01-04 08:20:08 -05:00
Alex Neundorf b01184022b Use absolute path to FindPackageHandleStandardArgs.cmake everywhere
This is to avoid getting an (older) copy of FPHSA.cmake which is
e.g. installed with KDE 4.5.0 and 4.5.1.

Alex
2010-09-28 22:30:31 +02:00
Philip Lowman 7016fae6d4 Fix 11136: [patch] FindThreads.cmake documents the wrong variable
Fixed documentation to be correct.
2010-09-18 13:46:08 -04:00
Todd Gamblin 2cde67a781 Modules: Fix spelling 'To distributed' -> 'To distribute' 2010-08-09 08:48:31 -04:00
Clinton Stimpson d09664a4d4 Support pthreads on irix. 2010-06-11 18:10:38 -06:00
Brad King c4bb9c9d42 Convert CMake find-modules to BSD License
This adds copyright/license notification blocks CMake's find-modules.
Many 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:45:50 -04:00
Philip Lowman 42618d5524 Improve readability 2009-09-20 08:03:45 -04:00
Bill Hoffman 0e5319f21d BUG: fix for 6586, set THREADS_FOUND 2008-09-11 11:41:00 -04:00
Brad King c5b197842f BUG: Enable CMAKE_HP_PTHREADS only when the old CMA threads are available. Modern HP pthreads are just normal pthreads. 2007-09-24 09:53:41 -04:00
Brad King 8481c4f1e9 BUG: Do not use CMA threads on HP if they do not exist. 2007-09-20 17:21:23 -04:00
Alexander Neundorf b82b47e329 STYLE: use FIND_PACKAGE_HANDLE_STANDARD_ARGS() also in FindMPI.cmake
-remove unnecessary ELSE() in FindThreads.cmake

Alex
2007-08-06 11:02:58 -04:00
Alexander Neundorf 7beee2df48 STYLE: don't use FIND_INCLUDE_FILE() but only FIND_INCLUDE_FILES() in
FindThreads.h

BUG: improve CheckC(XX)SourceRuns.cmake so that it works with cross
compiling, the return value has to go in the cache but shouldn't overwrite
the actual return value, and it should go only in the cache if we have a
result from try_run() otherwise we won't get here again if we have a result
later on

Alex
2007-07-31 13:30:10 -04:00
Alexander Neundorf eddf1cf39f ENH: improve TRY_RUN() for crosscompiling: instead of just failing, it now
creates two cache variables, one for the RUN_RESULT, one for the RUN_OUTPUT
(if required), which can be set or preset by the user. It has now also two
new arguments: RUN_OUTPUT_VARIABLE and COMPILE_OUTPUT_VARIABLE (the old
OUTPUT_VARIABLE merges both), so if only COMPILE_OUTPUT_VARIABLE is used the
run time output of the TRY_RUN is unused and the user doesn't have to care
about the output when crosscompiling. This is now used in FindThreads.cmake,
CheckC/CXXSourceRuns.cmake and TestBigEndian.cmake, which used the output
only for the logfile (compile output is still there). Test/TryCompile/ now
also tests the behaviour of OUTPUT_VARIABLE, RUN_OUTPUT_VARIABLE and
COMPILE_OUTPUT_VARIABLE.

Alex
2007-06-01 11:16:29 -04:00
Ken Martin 8e9a6beccc ENH: centralized locaiton of CMakeFiles setting 2006-06-14 12:28:32 -04:00
Ken Martin 74eaecfc3e ENH: cleanups 2005-12-15 14:17:43 -05:00
Bill Hoffman b7fa820118 ENH: add documentation support for modules 2005-12-14 13:51:08 -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
Brad King c6e15f5ddf BUG: Fix try-compile for sys/prctl.h. It needs to include sys/types.h first according to the man page. 2005-04-26 17:11:48 -04:00
Andy Cedilnik ad4f98f3cf ENH: Cleanup. Use relative path to modules 2004-08-26 22:52:53 -04:00
Andy Cedilnik 21ec23413e ERR: Reorganize to try to fix the -pthread problem on some systems 2003-08-22 09:52:05 -04:00
Andy Cedilnik 51301d8cc6 ENH: On apple use -lpthreads 2003-08-06 17:32:50 -04:00
Andy Cedilnik 7d1cbf26d9 ENH: MAke it work on FreeBSD 2003-08-01 17:11:46 -04:00
Andy Cedilnik ff5f0312de ENH: Do better test for pthreads 2003-08-01 16:48:41 -04:00
Bill Hoffman d05716c498 BUG: fix for thread and cache override 2002-11-18 15:14:44 -05:00
Bill Hoffman 7a8928eefc fix thread logic 2002-11-15 09:30:46 -05:00
Bill Hoffman 0b04a61366 add find threads check 2002-11-12 14:19:13 -05:00