Commit Graph

42 Commits

Author SHA1 Message Date
Stephen Kelly e0890d03a4 Features: Extend concept to C language.
Add properties and variables corresponding to CXX equivalents.

Add features for c_function_prototypes (C90), c_restrict (C99),
c_variadic_macros (C99) and c_static_assert (C11). This feature
set can be extended later.

Add a <PREFIX>_RESTRICT symbol define to WriteCompilerDetectionHeader
to conditionally represent the c_restrict feature.
2014-05-15 00:15:18 +02: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
Brad King 32b7c72623 Merge branch 'cmake-platform-info-version' into msvc-compiler-info
Conflicts:
	Modules/CMakeTestCCompiler.cmake
	Modules/CMakeTestCXXCompiler.cmake
	Modules/Platform/Windows-cl.cmake
2012-08-30 09:45:17 -04:00
Brad King 485a940e4c VS: Simplify MSVC version reporting
Teach Windows-cl.cmake to use CMAKE_(C|CXX)_COMPILER_VERSION to set the
"MSVC##" and MSVC_VERSION variables.  It no longer needs the IDE generator
to dictate the version or to detect the version by running the
command-line tool for NMake and Ninja generators.  Drop configuration of
CMakeCPlatform.cmake and CMakeCXXPlatform.cmake from Windows-cl.cmake.in
because all the results it saved are now cheap to compute every time.
2012-08-30 09:42:40 -04:00
Brad King 3df81b4912 Move CMAKE_<LANG>_COMPILER_WORKS to compiler information files
Since the parent commit this test result is specific to the version of
CMake.  Store it in the version-specific compiler information files
instead of CMakeCache.txt so testing can be re-done to meet the
requirements of the current version of CMake even if another version of
CMake was already used to configure the build tree.
2012-08-24 10:52:23 -04:00
Brad King 7195aca54f Make platform information files specific to the CMake version
At the top of a build tree we configure inside the CMakeFiles directory
files such as "CMakeSystem.cmake" and "CMake<lang>Compiler.cmake" to
save information detected about the system and compilers in use.  The
method of detection and the exact results store varies across CMake
versions as things improve.  This leads to problems when loading files
configured by a different version of CMake.  Previously we ignored such
existing files only if the major.minor part of the CMake version
component changed, and depended on the CMakeCache.txt to tell us the
last version of CMake that wrote the files.  This led to problems if the
user deletes the CMakeCache.txt or we add required information to the
files in a patch-level release of CMake (still a "feature point" release
by modern CMake versioning convention).

Ensure that we always have version-consistent platform information files
by storing them in a subdirectory named with the CMake version.  Every
version of CMake will do its own system and compiler identification
checks even when a build tree has already been configured by another
version of CMake.  Stored results will not clobber those from other
versions of CMake which may be run again on the same tree in the future.
Loaded results will match what the system and language modules expect.

Rename the undocumented variable CMAKE_PLATFORM_ROOT_BIN to
CMAKE_PLATFORM_INFO_DIR to clarify its purpose.  The new variable points
at the version-specific directory while the old variable did not.
2012-08-24 10:52:23 -04: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 5f6985ac86 Avoid clobbering variable 'OUTPUT' in compiler tests (#12628)
Use an obscure name and clean up afterwards.
2011-12-15 08:31:17 -05:00
Brad King a603250a13 Load platform files that need to know the ABI when possible
Load platform files named in CMAKE_<lang>_ABI_FILES for each language
once the ABI sizeof(void*) is known.  During the first configuration
this is after the test for working compiler and ABI detection checks.
During later configurations the ABI information is immediately available
because it has been saved in CMake<lang>Compiler.cmake.
2011-12-05 16:35:42 -05:00
Todd Gamblin 2cde67a781 Modules: Fix spelling 'To distributed' -> 'To distribute' 2010-08-09 08:48:31 -04:00
Brad King a443308c37 Load compiler information after configuring it
After configuring CMakeFiles/CMake<lang>Compiler.cmake in the build tree
the second time (to store ABI information), include it immediately.
This allows any logic and settings in the compiler information files to
be used without duplicating it in CMakeDetermineCompilerABI.cmake.

The change in commit "Use Fortran ABI detection results conservatively"
(2010-05-05) needs this to use the same logic to set CMAKE_SIZEOF_VOID_P
during first and later runs of CMake.
2010-05-06 11:26:49 -04:00
David Cole f48660fa85 Make a common function that prints the status during the checks for working compilers. Call it from all of the CMakeTesten_US.UTF-8Compiler.cmake files. In the message, print the full path to the tested compiler only for the Makefile generators. For Xcode and Visual Studio generators, print the generator instead so that users are not misled with the full path to a compiler that the generator may not even use. Xcode and Visual Studio have their own mechanisms for choosing the compiler to use during try_compile and build... 2010-02-12 14:32:20 -05: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 34744b6bc0 BUG: remove warning in test of compiler so -Werror does not fail 2009-06-22 10:02:51 -04:00
Bill Hoffman ad113d4df2 BUG: fix cmake so that if you configure with a bad env for cl, then with a good path, it will configure correctly 2009-04-18 14:37:04 -04:00
Brad King 8375bb4768 ENH: Remove unnecessary compiler force macros. The compiler ID can now be detected without linking an executable. 2008-02-14 10:50:43 -05:00
Brad King c12a7e388d BUG: When configuring compiler information files into the CMakeFiles directory in the project build tree, use IMMEDIATE option for CONFIGURE_FILE explicitly. It is needed in case the user sets CMAKE_BACKWARDS_COMPATIBILITY to 2.0 or lower. 2008-02-04 10:04:23 -05:00
Brad King bbbb2be765 BUG: When forcing the C and CXX compilers do not try to detect the ABI information. Cleanup configured language compiler info files by always using @ONLY. This addresses bug#6297. 2008-02-03 17:24:50 -05:00
Brad King a28b197b11 ENH: Generalize the check for sizeof void* to detect more ABI information. 2008-01-21 18:30:17 -05:00
Alexander Neundorf 61d3444f93 ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions

Alex
2007-05-17 13:20:44 -04:00
Andy Cedilnik e49b93989d COMP: More warnings and hp issues 2006-07-26 14:10:14 -04:00
Andy Cedilnik a9c0929d39 COMP: Handle both ansi and non-ansi C 2006-07-26 11:46:22 -04:00
Ken Martin 8e9a6beccc ENH: centralized locaiton of CMakeFiles setting 2006-06-14 12:28:32 -04:00
Ken Martin 4bdca3b404 ENH: put CmakeTmp into CMakeFiles 2006-01-12 13:49:32 -05:00
Bill Hoffman b7fa820118 ENH: add documentation support for modules 2005-12-14 13:51:08 -05:00
Bill Hoffman 03e2911e55 BUG: fix SIZEOF VOIDP problem 2005-11-14 14:21:39 -05:00
Brad King 7a3240160e BUG: Need to test void* not "void *" because the Intel compiler icc expands the asterisk. Thanks to Filipe Sousa for the patch. 2005-08-19 09:29:44 -04:00
Ken Martin c6b011e35e ENH: put cmake files intoa CMakeFiles subdir to clean up bin tree 2005-07-29 09:19:25 -04:00
Bill Hoffman 3ca1081419 BUG: try to address Bug 1673 . 2005-04-05 17:06:00 -04:00
Bill Hoffman 36dd18efce ENH: stuff to keep compiler tests from re-running all the time 2005-01-20 12:30:03 -05:00
Brad King 802cc38344 BUG#530: Using #error to report a nice error message if the C compiler is set to a C++ compiler. 2004-01-21 15:11:48 -05:00
Brad King 81be61b153 BUG#411: Re-ordering statements so errors show up in CMakeError.log. 2003-12-01 13:06:35 -05:00
Brad King ae28d81894 ERR: Fixed typo in comment. 2003-08-27 16:02:37 -04:00
Bill Hoffman a413160fec ENH: add the unix makefile generator as an option from the windows GUI, this builds with mingw, cygwin, and combinations of make cl, bcc32 2003-08-21 16:22:23 -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
Brad King c17220091c ERR: Fixed typeo tests->test. 2003-08-04 17:08:41 -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
Bill Hoffman 950399ec9d ENH: only run test for working c and cxx compiler once 2003-01-22 12:29:37 -05:00
Bill Hoffman 2f4ea98a4c add a fatal error, and make sure c and c++ compilers work before using them 2003-01-21 12:50:48 -05:00