summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_compile
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'env-init-configs'Brad King2021-11-233-0/+27
|\ | | | | | | | | | | | | | | 5b1ed2a646 try_compile: Do not use CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES env vars Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6755
| * try_compile: Do not use CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES env varsBrad King2021-11-223-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since: * commit e216b9bbd3 (cmake: Allow CMAKE_BUILD_TYPE to be set by environment variable, 2021-06-29, v3.22.0-rc1~503^2~1) * commit ef56eefc9b (cmake: Allow CMAKE_CONFIGURATION_TYPES to be set by environment variable, 2021-06-29, v3.22.0-rc1~503^2) the environment variables are supposed to provide defaults for settings the user otherwise can control via cache entries. However, they accidentally affect `try_compile` projects too, which are supposed to be programmatically controlled. Fixes: #22935
* | LCC: Add policy CMP0129 regarding interpreting LCC as GNUmakise-homura2021-10-211-2/+2
| | | | | | | | | | | | | | | | | | | | Due to MCST LCC compiler identification is now changed to LCC, there should be a way for old projects to still identify it as GNU, as it was before. This commits adds the policy: CMP0129: Compiler id for MCST LCC compilers is now LCC, not GNU. This policy controls such a behavior. OLD behaivior is to treat LCC as GNU, NEW is to treat is as LCC.
* | LCC: Add dedicated support for MCST LCC compilermakise-homura2021-10-151-3/+3
|/ | | | | | | | | | | | | | | | | | | | | Divert LCC compiler as a new one, instead of treating it as GNU. Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been passing checks for GNU compilers, so it has been identified as GNU. Now, with intent of seriously upstreaming its support, it has been added as a separate LCC compiler, and its version displays not a supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead of GNU 7.3.0). This commit adds its support for detection, and also converts basically every check like 'is this compiler GNU?' to 'is this compiler GNU or LCC?'. The only places where this check is untouched, is where it regards other platforms where LCC is unavailable (primarily non-Linux), and where it REALLY differs from GNU compiler. Note: this transition may break software that are already ported to Elbrus, but hardly relies that LCC will be detected as GNU; still such software is not known.
* Tests: Update for upstream ninja change to write status on stderrBrad King2021-02-231-0/+4
| | | | | | | | | | | | Upstream ninja commit `ad3d29fb53` (Put builder output through status interface) from ninja PR 1899 changed the status output from stdout to stderr. In particular, `ninja: no work to do` is now printed on stderr. Update our RunCMake tests to accept this difference. A few RunCMake test cases check for `ninja: no work to do`. For those, move the message to stdout using `RunCMake_TEST_OUTPUT_MERGE`. The rest of the test cases do not care about the message, so remove it from the actual stderr content before comparing against that expected.
* ISPC: Support generation for multiple instruction setsRobert Maynard2020-09-0412-0/+52
|
* Move AddCompilerRequirementFlag to cmStandardLevelResolverRobert Maynard2020-07-152-2/+2
| | | | | | | The cmLocalGenerator::AddCompilerRequirementFlag was another source of truth on what standard levels existed per language, so fold that into cmStandardLevelResolver to make updating CMake easier
* Tests/RunCMake: Update cmake_minimum_required versionsBrad King2020-06-183-2/+3
| | | | Use 3.3 or 2.8.12 where possible.
* Tests: Skip RunCMake.try_compile RerunCMake-nowork case on 1s filesystemsBrad King2020-06-011-2/+6
| | | | | | | | | | On low-resolution filesystems, `Makefile` can end up with the same time stamp as `CMakeCache.txt`. CMake must re-run in this case to be conservative, but that invalidates the `-nowork` cases. Rather than trying to detect 1s filesystems, just add an option called `CMake_TEST_FILESYSTEM_1S` that external scripts can use to tell CMake's test suite about this.
* cmCoreTryCompile::CleanupFiles now removes symlinks instead of their contents.Johnny Jazeix2019-12-262-0/+25
| | | | Fixes: #17522
* CUDA: Add cuda meta-features (e.g. ``cuda_std_11``) supportRobert Maynard2019-12-101-5/+1
|
* ObjC: Add try_compile supportCristian Adam2019-11-099-0/+44
| | | | Fixes: #19920
* Add deprecation warnings for policies CMP0067 and belowBrad King2019-07-011-0/+11
| | | | | | | The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for policies introduced in CMake 3.8 and below to encourage projects to port away from setting policies to OLD.
* Tests: fix failures with gnu mode clang on windowsZsolt Parragi2019-05-241-1/+3
| | | | | | | | | Root causes were: * Using incorrect conditions (assuming MSVC-like command line mode) * Trying to compile the MSVC STL in C++11 mode, when parts of it require C++14 or enabling MS extensions in clang. * Missing flush in a testcase using stdout in a dll and a main part with static crt
* Add deprecation warnings for policies CMP0066 and belowBrad King2019-02-211-1/+12
| | | | | | | The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for policies introduced in CMake 3.7 and below to encourage projects to port away from setting policies to OLD.
* Tests: Teach tests when to treat clang-cl as MSVCZsolt Parragi2019-02-111-1/+1
| | | | | | | | | | | | | | | | | | | * Disable the system include unused variable test in ExportImport when clang is in MSVC compatible mode. * Disable CxxDialect testcase when clang is in MSVC compatible mode, as it doesn't support `typeof`. * Teach Module.WriteCompilerDetectionHeader to treat clang-cl as MSVC. * Disable the SystemIncludeDirectories testcase within IncludeDirectories when clang is in MSVC compatible mode. * Disable the CMakeOnly.CheckCXXCompilerFlag testcase when clang is in MSVC compatible mode. * Treat clang-cl as MSVC in LinkOptions.cmake in the try_run and try_compile testcases.
* try_compile/try_run: Add support for LINK_OPTIONS option.Marc Chevrier2018-12-014-0/+57
|
* Add deprecation warnings for policies CMP0063 and belowBrad King2018-09-171-1/+12
| | | | | | The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for some policies to encourage projects to port away from setting policies to OLD.
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-013-5/+5
| | | | | | | | | | | | 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.
* CUDA: Port test cases to Windows with MSVC host compilerBrad King2017-01-122-1/+14
|
* try_compile: extend CMP0067 to honor language standards for CUDA.Robert Maynard2016-12-125-0/+22
|
* try_compile: Add policy CMP0067 to honor language standardsBrad King2016-12-065-0/+90
| | | | | | | | | | | | | | 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-0614-0/+112
| | | | | | | | | 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-222-0/+20
| | | | | | | | 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
* try_compile: Add policy CMP0066 to honor CMAKE_<LANG>_FLAGS_<CONFIG>Brad King2016-06-295-0/+81
| | | | | | | | | | | | | | | | 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.
* Revert "try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes"Brad King2016-06-283-21/+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.
* try_compile: Optionally forward custom platform variables to test projectBrad King2016-05-252-0/+27
| | | | | | | | | 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.
* Revise C++ coding style using clang-formatKitware Robot2016-05-162-3/+9
| | | | | | | | | | | | | 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: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes (#16054)Brad King2016-04-113-0/+21
| | | | | | | | 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`).
* try_compile: Add option to control type of targetBrad King2016-02-197-0/+41
| | | | | | | 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.
* Merge topic 'test-rerun-cmake'Brad King2015-01-278-0/+56
|\ | | | | | | | | | | 7f2dc8dc configure_file: Test that CMake re-runs on input change or output missing daf95a38 try_compile: Test that CMake re-runs on input change
| * try_compile: Test that CMake re-runs on input changeBrad King2015-01-278-0/+56
| | | | | | | | | | | | | | With the Makefile and Ninja generators we expect that touching the input source file for a try_compile will cause CMake to re-run on the next build. Extend the RunCMake.try_compile test with a case covering this. Also check that CMake does not re-run if nothing has changed.
* | try_run: Add support for LINK_LIBRARIES option.Matt McCormick2015-01-261-2/+2
|/ | | | | | | | Most functionality is already implemented in Source/cmCoreTryCompile.{h,cxx}. Document and improve argument parsing. This functionality is already being used by a number of modules, like CheckCSourceCompiles.cmake, but it is not documented.
* try_compile: Pass linker flags into test project (#14066)Brad King2014-12-034-0/+86
| | | | | | | | | | | | Copy CMAKE_EXE_LINKER_FLAGS into the test project generated by try_compile, just like we already copy CMAKE_<LANG>_FLAGS. Add CMake Policy CMP0056 to activate this behavior in a compatible way, but do not warn by default when the policy is not set since it will affect all try_compile calls. Extend the RunCMake.try_compile test with a case covering this behavior for each policy setting.
* Cygwin: Avoid legacy warnings in RunCMake.* testsBrad King2013-08-131-1/+1
| | | | | | Set the minimum required version of CMake high enough to avoid the warning for CMAKE_LEGACY_CYGWIN_WIN32. The warning appears on stderr and breaks the expected output matching.
* try_compile: Add COPY_FILE_ERROR option to capture failureBrad King2013-07-157-0/+16
| | | | | | | | | | | When the COPY_FILE operation fails optionally capture the error message with a COPY_FILE_ERROR option instead of reporting the error immediately. This gives callers a chance to do something else or report the error. Teach the RunCMake.try_compile test to cover bad argument combinations involving COPY_FILE_ERROR. Teach the TryCompile test to cover the case of a COPY_FILE error message captured by COPY_FILE_ERROR.
* try_compile: Add signature to allow multiple SOURCESBrad King2013-06-0610-0/+41
| | | | | | | | | | | | | | | | | Extend the signature try_compile(RESULT_VAR <bindir> <srcfile> ...) to allow multiple sources as try_compile(RESULT_VAR <bindir> SOURCES <srcfile>... ...) Process the sources to generate a CMakeLists.txt that enables all needed languages. Teach the TryCompile test to try cases with two sources of the same language and of mixed languages. Teach RunCMake.try_compile to cover error cases for the signature.
* try_compile: Refactor argument processingBrad King2013-05-3111-9/+17
| | | | | | | | | | Process all arguments in a single loop using a simple state machine. While at it, fix some error message typos. Also allow LINK_LIBRARIES with no actual libraries to disable use of the -DLINK_LIBRARIES=... from the CMAKE_FLAGS. This was already possible in the old logic if LINK_LIBRARIES was immediately followed by another keyword argument instead of the end of the argument list, so allow it in general. Update the RunCMake.try_compile test cases accordingly.
* try_compile: Add test for bad call error casesBrad King2013-05-3131-0/+79
Add a RunCMake.try_compile test to cover cases of bad invocation of the try_compile command.