Commit Graph

25 Commits

Author SHA1 Message Date
Alex Neundorf 35c48e1270 Check*.cmake: Expand imported targets in CMAKE_REQUIRED_LIBRARIES
Add the function cmake_expand_imported_targets() to expand imported
targets in a list of libraries into their on-disk file names for a
particular configuration.  Adapt the implementation from KDE's
HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES which has been in
use for over 2 years.  Call the function from all the Check*.cmake
macros to handle imported targets named in CMAKE_REQUIRED_LIBRARIES.

Alex
2012-02-21 15:38:15 -05:00
Rolf Eike Beer 813eca6416 CheckSymbolExists: force the compiler to keep the referenced symbol
Otherwise the compiler may optimize out the reference to the symbol as the
previous version was not really using this. This leads to symbols that are
only in a header but not in the given libraries to be reported as present.

This came up on the first try to fix bug 11333 as "gcc -O3" would optimize
out the reference to pthread_create() so the correct library the symbol is in
was not detected.

The new test code was suggested by Brad King.
2012-01-16 20:27:40 +01:00
David Cole 6b3993b0bf CheckSymbolExists: Use IMMEDIATE flag for configure_file (#11333)
The test "complex" sets the variable CMAKE_BACKWARDS_COMPATIBILITY
to 1.4. When that variable is set, configure_file does not default
to IMMEDIATE mode processing. And so, the output file likely does
not exist yet by the time the next line in the CMakeLists.txt file
is processed. When that next line is "try_compile" on that file,
this is a problem.

Fix the problem by explicitly using IMMEDIATE in the configure_file
call.

This problem was quite mysterious, as it only showed up on the
"complex" test, when the previous commit introduced a CheckSymbolExists
call into the FindThreads module. Which is not even explicitly included
in the "complex" test... FindThreads gets included indirectly only
as a side effect of setting CMAKE_BACKWARDS_COMPATIBILITY to 1.4 and
even then it's included indirectly by auto-inclusion of
CMakeBackwardCompatibilityC.cmake...

Wow. Just wow.
2011-08-22 15:50:03 -04:00
Alex Neundorf 6b71bf8876 Remove debug output from CheckSymbolExists
...which shouldn't have been committed.

Alex
2011-07-29 23:27:28 +02:00
Alex Neundorf 757a6a091c Add CheckCXXSymbolExists.cmake, so this can be used also for C++
This commit splits check_symbol_exists() so that the actual
implementation can be also used by check_cxx_symbol_exists()

Alex
2011-07-08 21:09:32 +02:00
Brad King 4995b267b7 Update CheckSymbolExists copyright year
Reflect that commit 840f9c05 (Document CheckSymbolExists more clearly,
2011-01-12) changed the file in 2011.
2011-01-17 14:10:55 -05:00
Brad King 840f9c055c Document CheckSymbolExists more clearly (#11685)
The check works for macros, functions, and variables, but not for types
or enumeration values.  Clearly describe the behavior of the check with
respect to each symbol type.
2011-01-12 08:58:19 -05: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
Ken Martin 8e9a6beccc ENH: centralized locaiton of CMakeFiles setting 2006-06-14 12:28:32 -04: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 0ddf06e952 ENH: Pay attention to CMAKE_REQUIRED_INCLUDES. 2006-02-09 14:28:01 -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 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 4e66ef8fe1 New design of CheckSymbolExists pretty much replaces all other ones.
For example:

CHECK_HEADER_EXISTS("type.h" HAVE_TYPE_H)
is:
CHECK_SYMBOL_EXISTS(main "type.h" HAVE_TYPE_H)

CHECK_LIBRARY_EXISTS("nsl"    gethostname  HAVE_LIBNSL)
would be
SET(CMAKE_REQUIRED_LIBRARIES "nsl")
CHECK_SYMBOL_EXISTS(gethostname "netdb.h" HAVE_LIBNSL)

...
2003-03-28 13:42:34 -05:00
Andy Cedilnik 4a2d04f42a Prevent CMake from putting ; in the file 2003-03-16 20:33:51 -05:00
Andy Cedilnik e71b03cbf0 Fix update date and cleanup 2003-02-28 12:42:50 -05:00
Andy Cedilnik 9ca8035fc6 Fix return value problem 2003-02-17 10:30:13 -05:00
Andy Cedilnik d87595ede3 Add macro for checking if symbol exists 2003-01-12 22:28:32 -05:00