summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* cmCoreTryCompile: Refactor forwarding of variables to test projectBrad King2016-05-251-74/+60
| | | | | | | De-duplicate the logic that constructs the cmake `-D` flag used to pass variables into the test project cache. Also subsume variables that were propagated by generating `set()` commands in the project and pass them as cache entries instead.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-364/+262
| | | | | | | | | | | | | 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.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Source: Stabilize include orderBrad King2016-04-291-0/+1
| | | | | Each source file has a logical first include file. Include it in an isolated block so that tools that sort includes do not move them.
* try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes (#16054)Brad King2016-04-111-0/+7
| | | | | | | | 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`).
* cmCoreTryCompile: Factor out config lookup for re-useBrad King2016-04-111-2/+4
| | | | | Store the lookup of CMAKE_TRY_COMPILE_CONFIGURATION in a local variable so we can re-use it.
* try_compile: Add option to control type of targetBrad King2016-02-191-10/+63
| | | | | | | 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.
* cmExportTryCompileFileGenerator: Port to cmGeneratorTarget.Stephen Kelly2015-10-181-4/+3
|
* cmState: Move GetTargetTypeName from cmTarget.Stephen Kelly2015-10-141-1/+1
|
* cmState: Move TargetType enum from cmTarget.Stephen Kelly2015-10-141-5/+5
| | | | | | | Mostly automated: values=( "EXECUTABLE" "STATIC_LIBRARY" "SHARED_LIBRARY" "MODULE_LIBRARY" "OBJECT_LIBRARY" "UTILITY" "GLOBAL_TARGET" "INTERFACE_LIBRARY" "UNKNOWN_LIBRARY" "TargetType") for i in "${values[@]}"; do git grep -l cmTarget::$i | xargs sed -i "s|cmTarget::$i|cmState::$i|g"; done
* cmCoreTryCompile: Fix internal argument vector constructionBrad King2015-09-241-5/+1
| | | | | | | | | In TryCompileCode we construct an internal argv[] vector that needs to have a fake argv[0] so our internal cmake command line looks like a real command line. Fix construction of the fake argv[0] when try_compile is called without the CMAKE_FLAGS argument. Otherwise the first internal -DVAR=val argument that we use to pass information like CMAKE_OSX_SYSROOT is ignored.
* try_compile: Propogate CMP0065 to the generated project.Chuck Atkins2015-09-211-0/+10
| | | | | | | Set policy CMP0065 to the value used in the calling project. Set the the value of CMAKE_ENABLE_EXPORTS if set in the calling project to initialize the target property appropriately.
* try_compile: Propogate the CMAKE_LINK_SEARCH_ variablesChuck Atkins2015-08-141-0/+10
|
* cmExportTryCompileFileGenerator: Create cmGeneratorTargets.Stephen Kelly2015-07-271-1/+1
| | | | | This is not a deprecated behavior, but only requires IMPORTED targets be made.
* Port static calls from cmLocalGenerator to cmOutputConverter.Stephen Kelly2015-06-061-3/+3
|
* Don't use a cmLocalGenerator instance to call static methods.Stephen Kelly2015-05-141-4/+4
|
* Port to static cmPolicies API.Stephen Kelly2015-05-041-4/+2
|
* cmState: Move CacheEntryType enum from cmCacheManager.Stephen Kelly2015-04-131-2/+1
|
* Include cmAlgorithms where it is used.Stephen Kelly2015-03-101-0/+1
|
* Convert some raw loops to cmWrap.Stephen Kelly2015-02-201-5/+3
|
* Use cmJoin where possible.Stephen Kelly2015-02-201-12/+3
|
* cmCoreTryCompile: Remove variable assignment.Stephen Kelly2015-02-171-2/+1
| | | | | The variable is not a reference, and we return in the same scope after assigning, so it has no effect.
* try_compile: Use shorter test executable name with consistent lengthBrad King2015-02-101-2/+2
| | | | | | | | | | | | | Since commit v2.8.8~176^2 (try_compile: Use random executable file name, 2012-02-13) the length of the test executable name in generated try_compile projects has been longer and unpredictable. With Visual Studio on windows, the tools try to create paths like: CMakeFiles/CMakeTmp/$tgt.dir/Debug/$tgt.tlog/$tgt.lastbuildstate With the target name repeated up to 3 times, we must make it short and of consistent length to avoid overrunning the 260 character limit imposed by VS tools.
* try_compile: Quote the content of CMAKE_MODULE_PATH to allow for spacesNils Gladitz2015-02-091-1/+1
|
* Merge topic 'try-run-link-libraries'Brad King2015-01-261-1/+1
|\ | | | | | | | | | | | | d0adcccb try_run: Add tests for LINK_LIBRARIES with mock libraries. 223c5cb7 try_run: Add test for bad link libraries. e2b1f058 try_run: Add support for LINK_LIBRARIES option.