summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Fortran: Fix submodule file names across compilersBrad King2019-02-141-0/+4
| | | | | | | | | The naming convention for submodule files varies across compilers. Add a table to the compiler information modules and thread the information through to the Fortran module dependency parser. Fill out the table for compiler ids known to support Fortran submodules. Fixes: #18746
* Use cmSourceFile::GetIsGeneratedSebastian Holtermann2019-02-011-1/+1
|
* Ninja: Use deps=gcc for Intel Compiler on WindowsBrad King2019-01-301-2/+22
| | | | | | | | | | | Ninja 1.9 supports the depfile format generated by this compiler. Use `deps = gcc` when the version of Ninja is new enough. Unfortunately the Intel Compiler for Windows does not properly escape spaces in paths written to a depfile so if there is a space in the path we must still fall back to `deps = msvc`. Fixes: #18855
* Ninja: Drop unnecessary deptype customization infrastructureBrad King2019-01-301-4/+0
| | | | | | Do not pass `CMAKE_NINJA_DEPTYPE_<LANG>` in place of `deps = gcc`. If Ninja ever introduces a new dependency type we will likely need to update CMake for it anyway.
* Ninja: support `SWIFT_MODULE_NAME` propertySaleem Abdulrasool2019-01-241-1/+6
| | | | | | | | Add a new `SWIFT_MODULE_NAME` property that defaults to the target name. This can be adjusted via `set_target_properties`. This is needed as otherwise, the first source file determines the module name. Issue: #18800
* Ninja: support `SWIFT_MODULE_NAME` propertySaleem Abdulrasool2019-01-181-2/+5
| | | | | | | | Add a new `SWIFT_MODULE_NAME` property that defaults to the target name. This is needed as otherwise, the first source file determines the module name. Issue: #18800
* Ninja: add new placeholder `SWIFT_AUXILIARY_SOURCES`Saleem Abdulrasool2019-01-151-0/+18
| | | | | | | | | The swift compilation model requires all sources for the module to be listed for the compiler to type check across them. Provide a placeholder to allow enumerating the remainder of the swift sources in a target for the language compile rule. Issue: #18800
* IWYU: Update CMake code for IWYU built with Clang 6Brad King2019-01-151-0/+1
| | | | | IWYU now correctly requires `<utility>` for `std::move`. It also requires a container header when used via a range-based for loop.
* clang-tidy: Remove redundant member initializationsRegina Pfeifer2018-12-151-2/+0
|
* cmMakefile: Make GetSafeDefinition return std::string const&Vitaly Stakhovsky2018-09-181-4/+2
|
* genex: Simplify cmGeneratorExpressionInterpreterBrad King2018-09-071-7/+4
| | | | | | | | | All callers were constructing with a non-empty target name using the target whose pointer was passed anyway. Drop this argument. Simplify logic accordingly. Re-order constructor arguments to match the cmCompiledGeneratorExpression::Evaluate arguments. Also remove unnecessary getters.
* cmGeneratedFileStream: clang-tidy applied to remove redundant ``c_str`` callsSebastian Holtermann2018-08-071-1/+1
| | | | | | | | | | | | | | | After changing the ``cmGeneratedFileStream`` methods to accept ``std::string const&`` instead of ``const char*`` we don't need to call ``std::string::c_str`` anymore when passing a ``std::string`` to a ``cmGeneratedFileStream`` method. This patch removes all redundant ``std::string::c_str`` calls when passing a string to a ``cmGeneratedFileStream`` method. It was generated by building CMake with clang-tidy enabled using the following options: -DCMAKE_CXX_CLANG_TIDY=/usr/bin/clang-tidy-4.0;-checks=-*,readability-redundant-string-cstr;-fix;-fix-errors
* LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDSMarc Chevrier2018-06-271-8/+7
| | | | Fixes: #17997
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-12/+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.
* Ninja: Avoid empty phony edges for target orderingBrad King2018-04-261-0/+13
| | | | | | | | | | | | | | | | Since commit v3.9.0-rc1~230^2~2 (ninja: break unnecessary target dependencies, 2017-04-17) we unconditionally generate a phony edge for target ordering. It is needed in case a later target depends on it. However, if the phony edge has no inputs then `ninja -d explain` prints: ninja explain: output ... of phony edge with no inputs doesn't exist Furthermore the phony edge's output is considered dirty and can cause dependents to be incorrectly considered dirty. Avoid this by always generating at least one input to the target ordering phony edges. If we have no real dependencies just use a path that always exists. Fixes: #17942
* Merge branch 'backport-ninja-issue-17942' into ninja-issue-17942Brad King2018-04-261-1/+3
|\
| * Ninja: Do not add empty custom command for file(GENERATE) outputsBrad King2018-04-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Internally we mark `file(GENERATE)` outputs as `GENERATED` in order to tell custom command dependency tracing logic not to expect the files to exist on disk yet. This is because we do not generate the files until after that tracing is done. The Ninja generator also interprets the `GENERATED` property to mean that it is expected that some build rule will generate the file if another build rule depends on it. If the generator does not know of a custom command that generates the file then it adds an empty one so that the `ninja` build tool does not complain about a dependency on a file that does not exist and has no rule to generate it. However, this step is not necessary for `file(GENERATE)` outputs because there is no build rule to generate them and they will exist before `ninja` runs. Add an additional `__CMAKE_GENERATED_BY_CMAKE` property internally to tell the Ninja generator that a `GENERATED` file will exist before the build starts and is not expected to have a build rule producing it. Fixes: #17942
* | Ninja: Fix Fortran support with response filesBrad King2018-04-051-18/+35
| | | | | | | | | | | | | | | | | | | | The Ninja generator splits preprocessing and compilation steps for Fortran. Fix this logic to work when using response files for compilation so that it works for the preprocessing step too. This fixes behavior under `CMAKE_NINJA_FORCE_RESPONSE_FILE`. Issue: #17877
* | cmNinjaTargetGenerator: Move force-rspfile check to earlierBrad King2018-04-051-4/+5
| |
* | cmNinjaTargetGenerator: Move depfile logic to later in its functionBrad King2018-04-051-47/+49
| | | | | | | | Clarify that other compile rule generation logic does not depend on it.
* | Merge topic 'co-compile-with-launcher'Brad King2018-02-281-13/+26
|\ \ | | | | | | | | | | | | | | | | | | eaf9f69d41 Fix combined use of compiler launcher with lint tools Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1791
| * | Fix combined use of compiler launcher with lint toolsIlya A. Kriveshko2018-02-271-13/+26
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using ccache with clang-tidy, ccache needs to wrap compiler invocation, rather than cmake invocation. But it needs to do it without affecting the command line that iwyu-like tools are receiving. With this fix, if __run_co_compile is used, compile launcher is passed using the new --launcher option, but if __run_co_compile is not needed, compiler launcher is prepended to the command line as before. To better illustrate the change: with this fix if running clang-tidy with CXX_COMPILER_LAUNCHER set to "/usr/bin/time;-p;ccache" (time -p added strictly for illustration purposes), the command line changes from: /usr/bin/time -p ccache cmake -E __run_co_compile \ --tidy=clang-tidy ... -- g++ ... to: cmake -E __run_co_compile \ --launcher="/usr/bin/time;-p;ccache" \ --tidy=clang-tidy ... -- g++ ... This allows the compiler to be run via the launcher, but leaves tidy (& friends) invocations unaffected. Fixes: #16493
* | Ninja: Use as dependency file <objectDir/SourceName>.d if needed.Claus Klein2018-02-201-2/+20
|/
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-4/+4
| | | | | | | | | | * 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-1/+1
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* Merge topic 'xl-qoptfile'Brad King2018-01-251-3/+9
|\ | | | | | | | | | | | | | | c4dc6485 XL: Enable use of response files for includes and objects e342e410 Makefile,Ninja: Use tool-specific response file flag for include dirs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1691
| * Makefile,Ninja: Use tool-specific response file flag for include dirsBrad King2018-01-241-3/+9
| | | | | | | | | | | | | | When we use a response file for `-I` flags, not all compilers support the `@<file>` syntax. Define `CMAKE_<LANG>_RESPONSE_FILE_FLAG` to specify tool-specific flag, just as we do for linking already via `CMAKE_<LANG>_RESPONSE_FILE_LINK_FLAG`.
* | sourceFile properties: add property INCLUDE_DIRECTORIESMarc Chevrier2018-01-241-1/+25
| |
* | sourceFile properties: add property COMPILE_OPTIONSMarc Chevrier2018-01-231-4/+11
|/ | | | | | | Add the support of per-source property COMPILE_OPTIONS, including generator expressions support. Related: #17507
* Genex: Per-source $<COMPILE_LANGUAGE:...> supportMarc Chevrier2017-12-131-8/+13
| | | | Fixes: #17542
* Add generator expression support to per-source COMPILE_DEFINITIONSMarc Chevrier2017-12-051-7/+14
| | | | | | This allows users to specify different genex-based compile definitions for each file in a target. Fixes: #17508
* Refactor per-source generator expression evaluationMarc Chevrier2017-12-041-6/+5
| | | | | | Prepare to add generator expression support to more source properties. Factor out some duplicated code into a helper to avoid further duplication.
* Fortran: Add option to run the compiler through launcher toolsBrad King2017-11-211-1/+1
| | | | | | | | | | Add a `Fortran_COMPILER_LAUNCHER` target property like those added for C and CXX by commit v3.4.0-rc1~450^2 (Add options to launch the compiler through tools like ccache or distcc, 2015-06-04) and CUDA by commit v3.10.0-rc1~531^2 (CUDA: Add option to run the compiler through launcher tools, 2017-06-09). Fixes: #17499
* Merge topic 'auto_ptr'Brad King2017-09-271-4/+4
|\ | | | | | | | | | | | | | | f0489856 Retire std::auto_ptr and its macro CM_AUTO_PTR Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Pavel Solodovnikov <hellyeahdominate@gmail.com> Merge-request: !1300
| * Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-251-4/+4
| | | | | | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>
* | Ninja: Fix quoting of RC language depfile in cmcldeps callBrad King2017-09-251-1/+1
|/ | | | | | | | | | | Since commit v3.0.0-rc1~448^2 (Ninja: use deps = gcc/msvc feature, 2013-10-18) the value of the `DEP_FILE` binding already includes the needed quoting to refer to the file. However, that commit forgot to update one of the `$DEP_FILE` references to not be quoted anymore. The offending code path currently only affects cmcldeps for RC. Remove the extra quoting now. Fixes: #17298
* Meta: replace empty-string assignments with `clear()`.Pavel Solodovnikov2017-09-151-1/+1
|
* Merge topic 'refactor-iwyu-code'Brad King2017-09-151-1/+1
|\ | | | | | | | | | | | | 3bbe95f5 Clean up iwyu code to not be one big if statement. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1247
| * Clean up iwyu code to not be one big if statement.Bill Hoffman2017-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | This commit changes the internal -E__run_iwyu to be -E__run_co_compile. This is used for co-compile commands. These are tools that want to mirror the compiler. For each compiler invocation the tool will be invoked first. This started as a way to implement include what you use (iwyu), but has expanded to include cpplint, cppcheck and others. Likely there will be more in the future as well. This commit implements each one in its own function and provides a way to add additional ones in the future with less work.
* | Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-48/+28
|/ | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* Add properties to run cppcheck along with the compilerBill Hoffman2017-08-301-2/+10
| | | | | | Create a `<LANG>_CPPCHECK` target property (initialized by a `CMAKE_<LANG>_CPPCHECK` variable) to specify a `cppcheck` command line to be run along with the compiler.
* Merge topic 'cxx11-nullptr'Brad King2017-08-251-3/+3
|\ | | | | | | | | | | | | 5962db43 Use C++11 nullptr Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1175
| * Use C++11 nullptrDaniel Pfeifer2017-08-241-3/+3
| |
* | Ninja: Fix references to source files in gfortran diagnosticsRaul Laasner2017-08-231-1/+7
|/ | | | | | | | | The Ninja generator preprocesses and compiles separately for Fortran. When compiling, tell gfortran that the source is already preprocessed so that it will honor the `# <line>` directives when producing diagnostics messages. Fixes: #17160
* Merge topic 'ninja_cuda_export_compile_commands_support'Brad King2017-07-141-6/+21
|\ | | | | | | | | | | | | 712af07e CUDA: CMAKE_EXPORT_COMPILE_COMMANDS now works with CUDA and Ninja Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1055
| * CUDA: CMAKE_EXPORT_COMPILE_COMMANDS now works with CUDA and NinjaRobert Maynard2017-07-131-6/+21
| | | | | | | | Fixes: #17061
* | Ninja: always use response file for cmake_ninja_dyndepYurii Batrak2017-07-101-8/+2
| | | | | | | | | | | | | | Command line argument passed to the internal tool "cmake_ninja_dyndep" could hit MAX_ARG_STRLEN on Linux for projects with a large code base. To prevent such problems, a response file was opted for argument transfer in all cases, not only on Windows.
* | CUDA: Add option to run the compiler through launcher toolsBrad King2017-06-091-1/+2
|/ | | | | | | | Add a `CUDA_COMPILER_LAUNCHER` target property like those added for C and CXX by commit v3.4.0-rc1~450^2 (Add options to launch the compiler through tools like ccache or distcc, 2015-06-04). Fixes: #16953
* Ninja: Fix escaping of path to depfileBrad King2017-05-301-4/+4
| | | | | Replace the dedicated and non-portable escaping code with use of our standard escaping logic.
* Merge topic 'ninja-dyndep-response-file'Brad King2017-04-251-4/+15
|\ | | | | | | | | | | | | 594d3d6f Ninja: support response file for cmake_ninja_depends on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !722