summaryrefslogtreecommitdiff
path: root/Source/cmCoreTryCompile.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Apple: Handle generation and comsuption of text-based stubs (.tbd files)Marc Chevrier2023-03-011-0/+6
| | | | Fixes: #24123
* try_compile: Record propagated CMake variables in configure logBrad King2023-02-011-0/+21
| | | | | | | These provide more detailed information about how the test project was configured. Issue: #23200
* clang-format: Add comments to suppress some formattingBrad King2023-01-181-0/+2
| | | | Preserve manually-formatted blocks.
* 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/+7
| | | | Issue: #23200
* try_compile: Report underlying error when COPY_FILE failsBrad King2023-01-161-12/+24
|
* TryCompileCode(): Prevent warning on return valueCraig Scott2022-12-301-1/+2
| | | | | | | | | | Some newer compilers warn in situations where the returned local variable could be movable, but a C++11 defect meant older compilers may still return a copy when a type conversion is involved. Adding the suggested std::move prevents that warning on that compiler, but creates a new warning on others. Constructing the actual return type explicitly with the suggested std::move on the constructor argument keeps both sets of compilers happy.
* ConfigureLog: Log try_compile and try_run checksMatthew Woehlke2022-12-161-0/+23
| | | | | | Add configure log events for `try_compile` and `try_run` results. Issue: #23200
* cmCoreTryCompile: Return more semantic information from compile stepBrad King2022-12-141-26/+29
| | | | | | 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: Restore COPY_FILE with CMAKE_TRY_COMPILE_CONFIGURATIONBrad King2022-11-221-4/+11
| | | | | | | | | Since commit 0c141b0393 (try_compile: Record output location instead of reverse computing it, 2022-08-31, v3.25.0-rc1~154^2) we always look for the "Debug" configuration's output binary from the test project. Restore looking for the `CMAKE_TRY_COMPILE_CONFIGURATION`. Fixes: #24180
* Merge topic 'try_compile-CMP0128' into release-3.25Brad King2022-10-191-0/+6
|\ | | | | | | | | | | | | | | 50e90e2828 try_compile: Honor CMP0128 setting in test project Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Merge-request: !7803
| * try_compile: Honor CMP0128 setting in test projectBrad King2022-10-181-0/+6
| | | | | | | | | | | | | | | | | | Some projects pass a raw `-std=` flag to the compiler in the `try_compile` project. If they do not set CMP0128 to NEW, we should not append a `-std=` flag where we did not before the policy was added. Fixes: #24063
* | try_compile: Report build dir with --debug-trycompileMatthew Woehlke2022-10-061-0/+7
| | | | | | | | | | | | | | | | When `--debug-trycompile` is enabled, issue a log (with trace) for every `try_compile` noting what directory is being used for the compilation. This will make it easier to find the corresponding artifacts. Closes: #24022
* | try_compile: Rename SOURCE_FROM_ARG -> SOURCE_FROM_CONTENTMatthew Woehlke2022-09-301-9/+10
| | | | | | | | | | | | | | | | | | 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-3/+9
| | | | | | | | | | | | | | Add NO_CACHE option to try_compile and try_run, which places the results in regular, rather than cache, variables. Issue: #22799
* | Merge topic 'try_compile-source-from'Brad King2022-09-231-8/+116
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 611d801790 try_compile: Add SOURCE_FROM_FILE a04eaf6742 Tests: Clean up and simplify TryCompile tests cb14ae2b87 try_compile: Add SOURCE_FROM_{ARG,VAR} Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7700
| * | try_compile: Add SOURCE_FROM_FILEMatthew Woehlke2022-09-221-0/+32
| | | | | | | | | | | | | | | | | | | | | 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-8/+84
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge topic 'try_run-no-project'Brad King2022-09-231-8/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | aac542f2f1 try_run: Remove PROJECT support Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7702
| * | | try_run: Remove PROJECT supportMatthew Woehlke2022-09-211-8/+4
| |/ / | | | | | | | | | | | | | | | Remove PROJECT support from try_run; it was never tested, has never been documented, and it's unclear how it should even work (since CMake wouldn't know what executable to run).
* | | try_compile: Improve error message consistencyMatthew Woehlke2022-09-161-3/+3
|/ / | | | | | | | | Tweak some error messages from try_compile (and try_run) to be more consistent with each other.
* | try_compile: Add PROJECT keyword-dispatched signatureMatthew Woehlke2022-09-141-30/+70
| | | | | | | | | | | | | | Introduce a new signature for the project flavor of try_compile (and try_run) which removes the `bindir` argument and adds a required PROJECT tag. This is similar to the SOURCES flavor added by commit aa9220d3 (try_compile: Add keyword-dispatched signature, 2022-09-02).
* | Merge topic 'MsvcDebugInformationFormatAbstraction'Brad King2022-09-141-0/+11
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | a858466aac MSVC: Add test for debug information format 0e96a20478 MSVC: Add abstraction for debug information format d4c8111da4 Clang/Windows: Clarify name of internal runtime library flags variables Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7606
| * | MSVC: Add abstraction for debug information formatGlen Chung2022-09-141-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace our hard-coded default for `/Zi` with a first-class abstraction to select the debug information format an enumeration of logical names. We've long hesitated to do this because the idea of "debug information format" touches on related concepts on several platforms. Avoid that scope creep by simply defining an abstraction that applies only when targeting the MSVC ABI on Windows. Removing the old default flag requires a policy because existing projects may rely on string processing to edit them and choose a runtime library under the old behavior. Add policy CMP0141 to provide compatibility. Fixes: #10189
* | | try_compile: Record output location instead of reverse computing itRobert Maynard2022-09-071-49/+36
|/ / | | | | | | Fixes #23887, #23942, #20163, #18288
* | try_compile: Add keyword-dispatched signatureMatthew Woehlke2022-09-051-20/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | try_compile: Don't accept try_run argumentsMatthew Woehlke2022-08-171-26/+6
| | | | | | | | | | | | | | | | | | | | | | Modify cmCoreTryCompile to only recognize try_run arguments when actually parsing try_run. (The old behavior was to recognize try_run arguments for try_compile also and then complain.) This has a small chance that a try_run keyword will be consumed as part of a multi-valued keyword argument. However, this behavior is more consistent with other commands, as we don't normally treat keywords as universally reserved. Also, the code is noticeably simplified.
* | try_compile: Fix quotes in reporting of unknown argumentsMatthew Woehlke2022-08-171-1/+1
| | | | | | | | | | | | | | | | In commit 6b427d8da9 (cmCoreTryCompile: Port to cmArgumentParser, 2022-08-01) we inadvertently dropped a matching quote during refactoring of reporting unknown arguments given to try_compile/try_run. Add the missing quote to match the old behavior and not have an imbalanced quote in the warning.
* | cmCoreTryCompile: Port to cmArgumentParserBrad King2022-08-021-354/+249
| |
* | cmCoreTryCompile: Move target type selection logic to try_compileBrad King2022-08-021-22/+1
| | | | | | | | | | 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-25/+25
| | | | | | | | The return value is only used as a boolean, so use `bool`.
* | cmCoreTryCompile: Select source-file signature project/target names earlierBrad King2022-07-261-8/+10
| |
* | cmCoreTryCompile: Compute src-file signature build directory earlierBrad King2022-07-261-7/+6
| |
* | try_compile: Refactor positional arg parsingBrad King2022-07-261-7/+14
| |
* | try_compile: Fail earlier when bindir is not an absolute pathBrad King2022-07-261-0/+16
| | | | | | | | | | If the bindir is not an absolute path, other errors occur later. Fail early with a clear error in this case.
* | Merge topic 'try_compile-cross-app-bundles'Brad King2022-06-171-2/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | 81549baff4 try_compile: Fix COPY_FILE with app-bundles on non-macOS hosts Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7377
| * | try_compile: Fix COPY_FILE with app-bundles on non-macOS hostsHeiko Lewin2022-06-161-2/+3
| | | | | | | | | | | | | | | | | | | | | Cross compiling from eg linux to apple-platforms requires handling of .app-Bundles. Fixes: #23597
* | | Merge topic 'cuda_use_response_files'Brad King2022-06-151-0/+9
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6377a43814 CUDA: Support response files with nvcc Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7358
| * | | CUDA: Support response files with nvccRobert Maynard2022-06-131-0/+9
| |/ /
* | | cmSystemTools: Fix 'ErrorOccurred' spellingFeRD (Frank Dana)2022-06-131-3/+3
|/ / | | | | | | | | | | | | | | Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to 's_ErrorOccurred' and 's_FatalErrorOccurred', respectively. Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and 'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
* | clang-tidy: address `modernize-use-default-member-init` lintsBen Boeckel2022-05-241-9/+5
| |
* | try_compile: Add option to skip passing platform variablesBrad King2022-05-161-3/+4
| | | | | | | | | | | | | | Add a `CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES` variable to tell `try_compile` not to pass platform variables to the test project. Issue: #23219
* | try_compile: Propagate platform variables in project-mode tooBrad King2022-05-161-1/+3
| | | | | | | | | | | | | | | | | | Add policy CMP0137 to propagate both our builtin variables and those listed by `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` to `try_compile` whole-project builds. Inspired-by: Alexander Neumann <Alexander.Neumann@hamburg.de> Fixes: #23219
* | OpenWatcom: Allow specifying the runtime libraryCameron Cawley2022-05-061-0/+10
| | | | | | | | | | | | | | | | Add a `CMAKE_WATCOM_RUNTIME_LIBRARY` variable to control the runtime library selection. Add policy CMP0136 to switch to in place of the old hard-coded default flags. Fixes: #23178
* | cmCoreTryCompile: Replace vector push_back with emplace_backBrad King2022-05-051-12/+12
| |
* | cmCoreTryCompile: Move platform variable forwarding to dedicated blockBrad King2022-05-051-97/+93
|/ | | | | | Prepare to enable the behavior under more conditions. Issue: #23219
* CheckSourceCompiles: Avoid linker warning with -fembed-bitcodeCraig Scott2022-04-091-0/+6
| | | | | | | | | | | | | | | When the Apple linker sees -headerpad_max_install_names and bitcode is enabled with a flag like -fembed-bitcode, it issues a warning and ignores the -headerpad_max_install_names flag. This causes unrelated compiler and linker flag checks to fail for valid flags. In f745e0497e (CheckCompilerFlags: Catch linker warning about ignored flags, 2022-01-03), we started detecting linker warnings, which caused a regression for projects that were setting -fembed-bitcode in their CMAKE_CXX_FLAGS or similar. Prevent that regression by removing the -headerpad_max_install_names linker flag when we know it will warn and be ignored anyway. Fixes: #23390 Issue: #23408
* Source: Replace most calls to sprintf with snprintfSean McBride2021-10-251-1/+2
|
* Source: Fix clang -Wimplicit-fallthrough warningsSean McBride2021-09-281-0/+3
|
* Rename cmProp in cmValueMarc Chevrier2021-09-211-15/+15
|