summaryrefslogtreecommitdiff
path: root/Modules/CheckTypeSize.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Help:Check*: include CMAKE_REQUIRED_* vars to dedupescivision2023-03-141-14/+12
| | | | | | 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*: refactor: use block(SCOPE_FOR POLICIES)scivision2023-03-081-2/+2
|
* Modules: Drop redundant check logging to CMakeOutput.log and CMakeError.logBrad King2023-01-181-5/+0
| | | | | | | | | | `try_compile` and `try_run` now automatically log checks using them to `CMakeConfigureLog.yaml`. Add `LOG_DESCRIPTION` arguments to some `try_compile` calls to replace the description previously written to the old logs. Issue: #23200
* Check*: Restore support for arbitrary result variable namesZhong Ruoyu2022-11-281-2/+3
| | | | | | | | | | | | | | | | | | | | In commit db76876db5 (Modules: Use new SOURCES_FROM_* try_compile (1/2), 2022-09-26, v3.25.0-rc1~74^2~1) and commit 41f7b1169a (Modules: Use new SOURCES_FROM_* try_compile (2/2), 2022-09-26, v3.25.0-rc1~74^2) the switch to `SOURCE_FROM_*` required a stronger precondition (the second argument to check_include_files must not have path components) than before (any variable name could be used). Fix that by transforming the variable name to a C identifier before feeding it to try_compile as a filename. The filename is unspecified by the documentation, and the file itself is only temporary, so that should work fine. I have gone through all the occurrences of `SOURCE_FROM_*`, and identified these two that require changes. The rest should work fine as the filenames do not depend on input variable names. Fixes: #24204
* Modules: Use new SOURCES_FROM_* try_compile (2/2)Matthew Woehlke2022-09-271-6/+6
| | | | | | | | | | | | | Modify some additional modules that ship with CMake to use the new SOURCES_FROM_* arguments to try_compile / try_run as added by commits cb14ae2b87 (try_compile: Add SOURCE_FROM_{ARG,VAR}, 2022-09-21) and 611d801790 (try_compile: Add SOURCE_FROM_FILE, 2022-09-22). This covers modules that need to read and alter a template source file, which were not addressed in the previous commit. Note that FindOpenACC.cmake does not actually need configure_file functionality; it appears to have inherited the (gratuitous) use thereof from FindOpenMP.cmake, with which its code bears significant similarity.
* Modules: Use new keyword-dispatched try_compile signatureMatthew Woehlke2022-09-141-1/+1
| | | | | | | | | | | Modify most of the modules that ship with CMake to use the new try_compile / try_run signatures added by commit aa9220d3a0 (try_compile: Add keyword-dispatched signature, 2022-09-02). This improves debugging by each invocation using its own directory so that the results of multiple invocations can be retained. This does not cover any invocations which provide an entire project, as that flavor of try_compile has not yet been updated.
* CheckTypeSize: Modernize and clarify documentationBrad King2022-02-181-29/+36
| | | | | | | Spell out the list of result variables as a definition list rather than in prose. Fixes: #23247
* Help: Add `.. versionadded` directives to module docsNikita Nemkin2020-12-021-10/+16
| | | | Issue: #19715
* CheckTypeSize: Use C++-style headers to check for std:: typesAiden Woodruff2020-07-201-18/+36
| | | | | In order to check for types like `std::uint8_t` in C++, we need to include `<cstdint>` instead of `<stdint.h>`.
* Refactor: Use added message types in various modulesAlex Turbov2019-11-021-3/+3
| | | | Co-Authored-By: Craig Scott <craig.scott@crascit.com>
* Check* functions family: add support for LINK_OPTIONSMarc Chevrier2018-12-011-30/+34
| | | | Fixes: #18521
* Help: Convert remaining modules to block-style commentsKitware Robot2018-10-221-66/+67
|
* Check*: Added include guardsCristian Adam2017-12-011-2/+4
|
* Use string(APPEND) in ModulesDaniel Pfeifer2017-05-171-2/+2
| | | | | | | 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'
* Simplify CMake per-source license noticesBrad King2016-09-271-13/+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.
* Use string(APPEND) in ModulesDaniel Pfeifer2016-07-281-5/+5
| | | | | | | 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'
* CheckTypeSize: Do not use cmake_policy(VERSION)Brad King2015-05-191-1/+0
| | | | | | | | | | | | | | Do not force a specific policy version in the module because it prevents projects from setting newer policies to NEW. In particular, projects may want to set CMP0056 to NEW to affect any try_compile calls in this module. Use of this was added in commit v2.8.2~539 (New CheckTypeSize for OS X Universal Binaries, 2009-12-17) and updated in commit v3.1.0-rc1~511^2~1 (Do not change minimum required version in modules, 2014-05-07). The history does not clearly explain why a specific policy version was introduced. If specific policies need to be NEW then we can add explicit settings for them.
* CheckTypeSize: Avoid if() auto-dereferene in quoted arguments (#15571)Rolf Eike Beer2015-05-191-4/+5
| | | | | Exposed by a CMP0054 warning. Set CMP0054 to NEW since no code in this module depends on the old behavior.
* Help: Document that the CHECK_* macros create cache variablesSebastian Leske2014-09-111-0/+3
| | | | Otherwise callers may expect to be able to re-use result variables.
* Do not change minimum required version in modulesDaniele E. Domenichelli2014-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | Some modules change CMake minimum required version when they are included. For example: cmake_minimum_required(VERSION 2.8.12) message("${CMAKE_MINIMUM_REQUIRED_VERSION}") include(CheckTypeSize) message("${CMAKE_MINIMUM_REQUIRED_VERSION}") will produce the following output: 2.8.12 2.6 This patch ensures that when you include a CMake module the minimum required version and the policies set are left unchanged. Fixes Issue #14864
* Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)Rolf Eike Beer2014-04-141-1/+1
| | | | | | The matches have already been calculated and can simply be taken from CMAKE_MATCH_n variables. This avoids multiple compilations of the same or very similar regular expressions.
* Check*.cmake : Add CMAKE_REQUIRED_QUIET flag.Clinton Stimpson2014-03-291-3/+10
| | | | | 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.
* CheckTypeSize: Support for CXX when C language is not enabledDaniele E. Domenichelli2014-03-151-3/+10
| | | | | | | | | | | This example now works without need to enable C language: cmake_minimum_required(VERSION x.x.x) project(foo CXX) include(CheckTypeSize) check_type_size("short" SIZEOF_SHORT LANGUAGE CXX) Fixes #14056
* CheckTypeSize: Unset temporary variables when done (#14690)Daniele E. Domenichelli2014-01-101-0/+2
| | | | | When the macro is invoked multiple times, the parsing variables were not unset and therefore used for all the following calls.
* CheckTypeSize: Add support for C++Daniele E. Domenichelli2013-10-211-6/+43
| | | | | | | | | | | | | | Previously if headers required to check the size of a type can be compiled with C++ compiler only, the check would fail because the C compiler fails. As a consequence, HAVE_${VARIABLE} would be set to false, and ${VARIABLE} will be empty. Teach CHECK_TYPE_SIZE to accept a new optional argument LANGUAGE that allows one to explicitly set the compiler to use. The new signature is therefore: CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY] [LANGUAGE <language>])
* Convert builtin help to reStructuredText source filesKitware Robot2013-10-151-32/+51
| | | | | | | | Run the convert-help.bash script to convert documentation: ./convert-help.bash "/path/to/CMake-build/bin" Then remove it.
* Handle targets in the LINK_LIBRARIES of try_compile.Stephen Kelly2013-02-221-4/+1
| | | | | | | | | | Imported targets are re-exported so that they can be used by the try_compile generated code with target_link_libraries. This makes the use of the cmake_expand_imported_targets macro obsolete. The macro is not able to expand the generator expressions which may appear in the IMPORTED_LINK_INTERFACE_LIBRARIES content. Instead it just sees them as 'not a target'.
* CheckTypeSize: show in documentation how to get struct member size (#10579)Rolf Eike Beer2012-08-141-0/+5
|
* Remove CMake-language block-end command argumentsKitware Robot2012-08-131-2/+2
| | | | | | | | | | | | | | | | | 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
* Check*.cmake: Expand imported targets in CMAKE_REQUIRED_LIBRARIESAlex Neundorf2012-02-211-1/+6
| | | | | | | | | | | 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
* Modules: Fix spelling 'To distributed' -> 'To distribute'Todd Gamblin2010-08-091-1/+1
|
* New CheckTypeSize for OS X Universal BinariesBrad King2009-12-171-89/+163
| | | | | | We re-implement this module to support architecture-dependent type sizes. In the mixed-size case we generate C preprocessor code to select the detected type size for each architecture.
* Convert CMake non-find modules to BSD LicenseBrad King2009-09-281-0/+13
| | | | | | | 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.
* ENH: allow users to turn off extra checksBill Hoffman2008-04-251-4/+10
|
* ENH: make sure all required headers are checked before checking type sizeBill Hoffman2008-04-251-1/+13
|
* STYLE: remove unused CheckTypeSize.c.inAlexander Neundorf2007-08-101-1/+1
| | | | | | | | ENH: change test for endianess from TRY_RUN() to TRY_COMPILE() by testing the binary image of a 16bit integer array, tested on Linux x86, Intel Mac and Sun (big endian) Alex
* STYLE: remove out commented codeAlexander Neundorf2007-06-071-7/+5
| | | | Alex
* ENH: determine typesize by compiling a file and reading strings from the ↵Alexander Neundorf2007-06-041-54/+72
| | | | | | | | | compiled output. Tested with various gcc, XCode, MSVC7, sdcc For OSX when doing TRY_COMPILE() CMAKE_OSX_ARCHITECTURES is used, if there are different results an error is generated. CMAKE_OSX_ARCHITECTURES can be overwritten for the TRY_COMPILES with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES. Alex
* STYLE: remove debug output, fix indentationAlexander Neundorf2007-05-241-52/+50
| | | | | | | the tests run again successfully, but since CheckTypeSize will switch to a TRY_COMPILE soon I will look at it again after this change Alex
* COMP: try to fix the test failures on dash2Alexander Neundorf2007-05-241-0/+2
| | | | Alex
* ENH: Use IF(NOT DEFINED) check to short-circuit size test.Brad King2007-05-171-2/+2
|
* ENH: merge CMake-CrossCompileBasic to HEADAlexander Neundorf2007-05-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | -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
* ENH: centralized locaiton of CMakeFiles settingKen Martin2006-06-141-5/+5
|
* ENH: Added CMAKE_REQUIRED_DEFINITIONS and CMAKE_REQUIRED_INCLUDES to the ↵Brad King2006-02-141-1/+17
| | | | interface.
* ENH: fix check type sizeBill Hoffman2006-01-221-0/+1
|
* ENH: fix checktypesizeBill Hoffman2006-01-131-1/+2
|
* ENH: move define into configured file and do not use the command lineBill Hoffman2006-01-121-2/+2
|
* ENH: put CmakeTmp into CMakeFilesKen Martin2006-01-121-3/+3
|
* ENH: some style fixes for the bookKen Martin2005-12-151-1/+1
|
* ENH: add documentation support for modulesBill Hoffman2005-12-141-5/+4
|