summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'ghs_os_dir'Brad King2019-04-081-2/+3
|\ | | | | | | | | | | | | | | a1e6b414b9 GHS: Update GHS_BSP_NAME processing 266dadf868 GHS: Print status message regarding GHS_OS_DIR Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3123
| * GHS: Print status message regarding GHS_OS_DIRFred Baksik2019-03-291-2/+3
| | | | | | | | | | | | | | | | | | -- Rename platform script so it runs before initial try_compile() in project() command. -- Fix incorrect variable name GHS_OS_DIR_OPTION -- Remove unnecessary ".*" from REGEX expression for GHS_CANDIDATE_OS_DIRS -- Forward GHS_OS_DIR_OPTION to try_compile() and preserve trailing whitespace of the variable.
* | Merge topic 'toolchain-include_directories'Brad King2019-03-261-1/+16
|\ \ | |/ |/| | | | | | | | | 588fa1bb9e Restore support for include_directories() in toolchain files Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3140
| * Restore support for include_directories() in toolchain filesBrad King2019-03-251-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Any `include_directories()` calls in toolchain files are used during our ABI detection step even though it does not include any system headers. Since commit 5990ecb741 (Compute implicit include directories from compiler output, 2018-12-07, v3.14.0-rc1~108^2), that check is also used to detect implicit include directories. Any `include_directories()` in a toolchain file are detected as implicit and later excluded from explicit specification on compiler command lines, thus breaking the purpose of the calls in the first place. Fix the implicit include directory detection step to avoid using paths from `include_directories()` calls in the toolchain file. Fixes: #19079
* | cmSystemTools::Error: consolidate parameters into single std::stringVitaly Stakhovsky2019-02-201-2/+2
|/
* try_compile: Restore expansion of ;-list in COMPILE_DEFINITIONSBrad King2019-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | The quoting added by commit 8c5221fb1f (try_compile: Preserve special characters in COMPILE_DEFINITIONS, 2019-01-21, v3.14.0-rc1~108^2~3) broke the case that the `COMPILE_DEFINITIONS` value contains a `;`. Without the quoting the `;` would be generated literally in an unquoted argument in the test `CMakeLists.txt` file and would then be expanded. With quoting the `;` is preserved, which is not the old behavior. Fix this by expanding the `;`-list ahead of time. Add test cases for behavior with both `#` and `;`. This was noticed with the PGI compiler where we set `CMAKE_CXX*_STANDARD_COMPILE_OPTION` to values like `--c++17;-A`. The symptom had also been observed while preparing commit ef8f237686 (ParseImplicitIncludeInfo: add SunPro Fortran and PGI compiler, Cray fix, 2019-01-29, v3.14.0-rc1~26^2~2) but was not recognized at the time as a regression. Revert the workaround added by that commit. Fixes: #18919
* Merge topic 'cmake-files-directory'Brad King2019-01-251-1/+1
|\ | | | | | | | | | | | | | | 3e867ed400 cmake: inlined files dir constant and removed it from cmake.h Acked-by: Kitware Robot <kwrobot@kitware.com> Rejected-by: vvs31415 <vstakhovsky@fastmail.com> Merge-request: !2655
| * cmake: inlined files dir constant and removed it from cmake.hBruno Manganelli2019-01-211-1/+1
| |
* | Merge topic 'implicit-includes'Brad King2019-01-221-1/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5990ecb741 Compute implicit include directories from compiler output d751d2d2ed CMakeDetermineCompilerABI: set locale to C for try_compile() c765ae495a CMakeDetermineCompilerABI: pass verbose flag during compilation 8c5221fb1f try_compile: Preserve special characters in COMPILE_DEFINITIONS 15ad830062 Refactor exclusion of -I/usr/include to avoid per-language values Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2716
| * | try_compile: Preserve special characters in COMPILE_DEFINITIONSBrad King2019-01-211-1/+3
| | | | | | | | | | | | | | | | | | | | | When generating the `CMakeLists.txt` file, we pass the values given to our `COMPILE_DEFINITIONS` option in an `add_definitions` call. Pass them as bracket arguments to preserve special characters like `#`.
* | | Merge topic 'use-emplace'Brad King2019-01-211-2/+2
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | ef61997b1b clang-tidy: Use emplace 2e5307a2a4 CTestSVN: Accept std::string in SVNInfo constructor Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2811
| * | clang-tidy: Use emplaceRegina Pfeifer2019-01-171-2/+2
| |/
* | GHS: try_compile() now uses GHS platform variablesFred Baksik2019-01-161-0/+16
|/ | | | | | | -- Forward GHS platform variables to try_compile() CMAKE_TRY_COMPILE_PLATFORM_VARIABLES only worked for source signature try_compile() -- Update tests to no longer add GHS platform variables to try_compile() -- Avoid linker error in GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt by building library
* Factor out enum MessageType into dedicated headerBruno Manganelli2019-01-161-30/+33
| | | | Reduce the number of files relying on `cmake.h`.
* PIE link options: Update strategy to fix performance regressionMarc Chevrier2018-12-191-0/+18
| | | | Fixes: #18700
* try_compile/try_run: Add support for LINK_OPTIONS option.Marc Chevrier2018-12-011-0/+23
|
* CMP0083: fix warning message on try_compileMarc Chevrier2018-11-191-0/+7
| | | | Fixes: #18593
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-11/+17
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * 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.
* cmake: Add options for parallel builds to --build modeFlorian Maushart2018-05-251-1/+2
| | | | | | | While we already support `cmake --build . -- -j`, the options after `--` are specific to the native build tool. Add new options `--parallel [<N>]` and `-j [<N>]` to abstract this and map to the proper option for the native build tool.
* Genex: Fix COMPILE_LANGUAGE propagation through try_compileBrad King2018-03-121-1/+2
| | | | | | | | When evaluating include directories during export to a `try_compile` test project, thread the compile language through to the generator expression evaluator so it can support `$<COMPILE_LANGUAGE:...>`. Issue: #17811
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-11/+9
| | | | | | | | | | * 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.
* Reduce allocation of temporary values on heap.Pavel Solodovnikov2018-01-261-5/+5
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* Meta: replace empty-string assignments with `clear()`.Pavel Solodovnikov2017-09-151-3/+3
|
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-30/+21
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* IWYU: Mark cmConfigure.h with pragma: keepDaniel Pfeifer2017-08-261-1/+0
| | | | Also remove `#include "cmConfigure.h"` from most source files.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-1/+1
|
* Provide and use CM_FALLTHROUGHDaniel Pfeifer2017-06-031-0/+4
|
* Access string npos without instancePavel Solodovnikov2017-06-011-1/+1
|
* Add options for separate compile and link sysrootsBrad King2017-05-091-0/+4
| | | | | | | | | Add `CMAKE_SYSROOT_COMPILE` and `CMAKE_SYSROOT_LINK` variables to as operation-specific alternatives to `CMAKE_SYSROOT`. This will be useful for Android NDKs that compile and link with different sysroot values (e.g. `r14` with unified headers). Co-Author: Florent Castelli <florent.castelli@gmail.com>
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-2/+2
| | | | | | | | | | | | | 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'
* fix some include-what-you-use diagnosticsDaniel Pfeifer2017-02-171-0/+1
|
* try_compile: extend CMP0067 to honor language standards for CUDA.Robert Maynard2016-12-121-2/+77
|
* clang-tidy: apply misc-suspicious-string-compare fixesDaniel Pfeifer2016-12-121-11/+6
|
* clang-tidy: apply readability-redundant-control-flow fixesDaniel Pfeifer2016-12-121-1/+0
|
* try_compile: Add policy CMP0067 to honor language standardsBrad King2016-12-061-0/+79
| | | | | | | | | | | | | | 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
* try_compile: Add options to specify language standardsBrad King2016-12-061-0/+128
| | | | | | | | | Give `try_compile` callers a way to control the `CXX_STANDARD`, `CXX_STANDARD_REQUIRED`, and `CXX_EXTENSIONS` properties of the generated test target (or the `C` equivalents) in order to compile a test source for a particular language standard. Issue: #16456
* try_compile: Honor CMAKE_WARN_DEPRECATED in test projectBrad King2016-11-221-0/+2
| | | | | | | | This causes the `-Wno-deprecated` option to be honored even inside a `try_compile` test project, which is needed to suppress all deprecation warnings as the option documents. Closes: #16446
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-3/+11
|
* Remove redundant c_str() callsDaniel Pfeifer2016-10-301-5/+5
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-0/+1
|
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Move CacheEntryType enum to separate namespaceStephen Kelly2016-10-191-1/+1
| | | | Port dependent code to the change.
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-18/+19
|
* 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.
* Avoid else after returnDaniel Pfeifer2016-09-161-2/+1
|
* try_compile: Add policy CMP0066 to honor CMAKE_<LANG>_FLAGS_<CONFIG>Brad King2016-06-291-0/+37
| | | | | | | | | | | | | | | | In the `try_compile` source file signature we propagate the caller's value of `CMAKE_<LANG>_FLAGS` into the test project. Extend this to propagate `CMAKE_<LANG>_FLAGS_<CONFIG>` too instead of always using the default value in the test project. This will be useful, for example, to allow the MSVC runtime library to be changed (e.g. `-MDd` => `-MTd`). However, some projects may currently depend on this not being done, so we need to activate the behavior using a policy. This change was originally made by commit v3.6.0-rc1~160^2 (try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes, 2016-04-11) but without the policy and so had to be reverted during the 3.6 release candidate cycle. Fixes #16174.
* Merge topic 'revert-try_compile-config-flags'Brad King2016-06-291-8/+0
|\ | | | | | | | | 943fe6e3 Revert "try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes"
| * Revert "try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes"Brad King2016-06-281-8/+0
| | | | | | | | | | | | | | | | | | | | Revert commit v3.6.0-rc1~160^2 (try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes, 2016-04-11). The behavior it introduced can break projects that depend on the lack of such behavior. We will have to introduce a policy or other mechanism to enable the behavior in a compatible way. Simply revert it for now. See issue #16174.
* | use CM_NULLPTRDaniel Pfeifer2016-06-281-1/+1
|/
* try_compile: Optionally forward custom platform variables to test projectBrad King2016-05-251-0/+9
| | | | | | | | | Add a `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable to specify a list of custom variables to be forwarded to a `try_compile` test project. This will be useful for platform information modules or toolchain files to forward some platform-specific set of variables from the host project (perhaps set in its cache) to the test project so that it can build the same way.