summaryrefslogtreecommitdiff
path: root/Source/cmCoreTryCompile.h
Commit message (Collapse)AuthorAgeFilesLines
* try_compile: Record propagated CMake variables in configure logBrad King2023-02-011-0/+1
| | | | | | | These provide more detailed information about how the test project was configured. Issue: #23200
* try_compile: Add a NO_LOG option to skip recording in the configure logBrad King2023-01-161-0/+1
|
* try_compile: Add optional LOG_DESCRIPTION to record in configure logBrad King2023-01-161-0/+3
| | | | Issue: #23200
* ConfigureLog: Log try_compile and try_run checksMatthew Woehlke2022-12-161-0/+11
| | | | | | Add configure log events for `try_compile` and `try_run` results. Issue: #23200
* cmCoreTryCompile: Return more semantic information from compile stepBrad King2022-12-141-2/+7
| | | | | | Update the `TryCompileCode` signature to allow callers to distinguish between administrative failures and a compilation failure. Return results in a structure to which more information can be added later.
* try_compile: Rename SOURCE_FROM_ARG -> SOURCE_FROM_CONTENTMatthew Woehlke2022-09-301-1/+1
| | | | | | | | | Change the SOURCE_FROM_ARG keyword to try_compile to SOURCE_FROM_CONTENT (which we can do because it was recently added and hasn't been in a release yet). The new name should be clearer as to what it does, and also more consistent with the CONTENT arguments to some other commands. Also, fix a typo in an error message.
* try_compile: Add NO_CACHE option (also try_run)Matthew Woehlke2022-09-281-0/+1
| | | | | | | Add NO_CACHE option to try_compile and try_run, which places the results in regular, rather than cache, variables. Issue: #22799
* try_compile: Add SOURCE_FROM_FILEMatthew Woehlke2022-09-221-0/+2
| | | | | | | Add ability to copy try_compile (and try_run) source files from arbitrary locations into the operation directory. This is included for the sake of completion and consolidation, although use cases which actually require this may be rare.
* try_compile: Add SOURCE_FROM_{ARG,VAR}Matthew Woehlke2022-09-221-0/+7
| | | | | | | | Add ability to "feed" try_compile (and try_run) sources more directly, either from literal content, or from a CMake variable which contains literal content. This saves the user from needing a separate step to write the content to a file, and allows for the sources to only exist in the scratch directory.
* try_compile: Record output location instead of reverse computing itRobert Maynard2022-09-071-2/+1
| | | | Fixes #23887, #23942, #20163, #18288
* try_compile: Add keyword-dispatched signatureMatthew Woehlke2022-09-051-3/+17
| | | | | | | | | | | | | | | | Introduce a new signature for try_compile (and try_run) which removes the `bindir` argument and requires the SOURCES tag. This will eventually allow us to add other ways of providing sources, but also allows us to change the behavior without breaking compatibility. The old signature uses a special, but non-unique temporary location inside the specified `bindir`, which conventionally is just the project's build directory. The new signature unconditionally uses the a unique temporary directory which is unconditionally within the project's build directory (which is no longer separately specified). This ensures that successive runs do not overwrite previous runs, will simplify debugging, and should also, eventually, allow us to execute multiple trials in parallel.
* cmCoreTryCompile: Port to cmArgumentParserBrad King2022-08-021-1/+42
|
* cmCoreTryCompile: Move target type selection logic to try_compileBrad King2022-08-021-1/+2
| | | | | This is specific to `try_compile` since `try_run` always needs an executable. Move the logic out of the common code path.
* cmCoreTryCompile: Simplify TryCompileCode return typeBrad King2022-08-021-1/+1
| | | | The return value is only used as a boolean, so use `bool`.
* cmTry{Compile,Run}Command: Port away from legacy cmCommandBrad King2022-07-261-3/+9
| | | | Convert the command entry points to free functions.
* Modernize: Use #pragma once in all header filesKitware Robot2020-09-031-4/+1
| | | | | | | | | | | | | | | | #pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
* try_compile: Refactor language standard level parsingRobert Maynard2020-06-171-4/+0
| | | | | | | cmCoreTryCompile had significant code duplication around handling languages that offer standard levels. This refactoring reduces the complexity and makes it easier to add new languages in the future.
* Add in-class initialization of some membersjrp20142018-04-051-1/+1
| | | | | | Several class constructors leave members uninitialized. The members are initialized before use in methods, but it is clearer and less error-prone to initialize them at their definition site.
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-1/+1
| | | | | | | | | | * Change some functions to take `std::string` instead of `const char*` in the following classes: `cmMakeFile`, `cmake`, `cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator` and a few others. * Greatly reduce using of `const char*` overloads for `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`. * Remove many redundant `c_str()` conversions throughout the code.
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-1/+1
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* try_compile: Add policy CMP0067 to honor language standardsBrad King2016-12-061-0/+4
| | | | | | | | | | | | | | Projects use `try_compile` to check if they will be able to compile some particular source code. When a language standard variable like `CMAKE_CXX_STANDARD` is set, then the project intends to compile source code using a compiler mode for that standard. Therefore it makes sense for `try_compile` to use that standard in the test project too. Unfortunately this was not done when support for the `CMAKE_CXX_STANDARD` variable was first implemented. Add a policy to introduce the improved behavior in a compatible way. Closes: #16456
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-0/+5
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-0/+1
|
* Make cmCommand not inherit from cmObjectDaniel Pfeifer2016-10-231-2/+0
|
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-1/+1
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-4/+1
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* try_compile: Add option to control type of targetBrad King2016-02-191-3/+3
| | | | | | | Create a `CMAKE_TRY_COMPILE_TARGET_TYPE` option to specify use of `add_library(... STATIC ...)` for the generated test project. This will be useful for cross-compiling toolchains that cannot link a binary without custom flags or scripts.
* stringapi: Use strings in target nameBen Boeckel2014-03-081-1/+1
|
* Remove trailing whitespaceAlex Neundorf2011-09-151-7/+7
| | | | Alex
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | This converts the CMake license to a pure 3-clause OSI-approved BSD License. We drop the previous license clause requiring modified versions to be plainly marked. We also update the CMake copyright to cover the full development time range.
* ENH: add two simple tests for TRY_RUN()Alexander Neundorf2007-05-241-0/+65
STYLE: create a new base class cmCoreTryCompile, from which cmTryCompileCommand and cmTryRunCommand are derived, so there are no public static functions with lots of arguments anymore Alex