summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Add properties to run the cpplint style checker with the compilerJamie Snape2017-01-231-1/+9
| | | | | | Create a `<LANG>_CPPLINT` target property (initialized by a `CMAKE_<LANG>_CPPLINT` variable) to specify a `cpplint` style checker command line to be run along with the compiler.
* CUDA: Detect MSVC architecture idBrad King2017-01-121-1/+2
|
* Makefile,Ninja: De-duplicate MSVC compiler PDB path selectionBrad King2016-12-151-15/+1
| | | | | Add a helper to cmCommonTargetGenerator instead of duplicating it in cmMakefileTargetGenerator and cmNinjaTargetGenerator.
* Merge topic 'clang-tidy'Brad King2016-12-121-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | b932cd42 clang-tidy: apply misc-redundant-expression fixes 88da3d68 clang-tidy: apply misc-suspicious-string-compare fixes 58c66393 clang-tidy: apply readability-static-definition-in-anonymous-namespace fixes 85bfddda clang-tidy: apply readability-redundant-control-flow fixes 2988abd9 clang-tidy: apply modernize-use-bool-literals fixes a74e6893 clang-tidy: apply readability-redundant-string-init fixes cac529dd clang-tidy: apply performance-faster-string-find fixes 7c9db8f8 clang-tidy: apply performance-unnecessary-value-param fixes
| * clang-tidy: apply readability-redundant-string-init fixesDaniel Pfeifer2016-12-121-1/+1
| |
* | Merge topic 'fix-ctest-launchers'Brad King2016-12-121-0/+1
|\ \ | |/ |/| | | | | | | | | db61cd5d cmRulePlaceholderExpander: Remove unused member RuleLauncher b7771078 Comment ExpandRuleVariables calls not preceded by launcher insertion c58a5198 Makefile: Restore RULE_LAUNCH_COMPILE generation on compilation rules
| * Comment ExpandRuleVariables calls not preceded by launcher insertionBrad King2016-12-091-0/+1
| | | | | | | | | | | | | | Call sites of `ExpandRuleVariables` are now responsible for inserting the `RULE_LAUNCH_{COMPILE,LINK,CUSTOM}` values in rule command lines. Audit all call sites and add a comment to each one that does not insert a launcher to explain why.
* | Ninja,Makefile: Name static library compile PDB files as VS doesBrad King2016-11-301-0/+7
| | | | | | | | | | | | | | | | | | | | Change the default compile PDB file name for static libraries to match the Visual Studio default of using the logical target name. This may be incompatible with existing behavior but `COMPILE_PDB_NAME` documents that the default is unspecified. Projects depending on a particular name should set the property. Closes: #16438
* | CUDA: Add support for the CUDA_SEPARABLE_COMPILATION target propertyRobert Maynard2016-11-141-3/+15
| |
* | Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-8/+11
| |
* | Add generator expression support to per-source COMPILE_FLAGSZsolt Parragi2016-10-281-2/+8
| | | | | | | | | | | | This allows users to specify different genex-based compile flags for each file in a target, e.g. compiling just a single file with `Od/Ox` in release builds on Visual Studio.
* | Merge topic 'clang-tidy'Brad King2016-10-201-2/+4
|\ \ | | | | | | | | | | | | | | | effa6c83 fix more issues reported by clang-tidy fb461cac silence selected clang-tidy violations
| * | fix more issues reported by clang-tidyDaniel Pfeifer2016-10-201-2/+4
| |/
* | cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | | | | | | Include it in dependents which have previously relied on it transitively.
* | cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
| |
* | cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-14/+14
|/
* cmRulePlaceholderExpander: Port clients to direct-useStephen Kelly2016-10-151-9/+16
| | | | | | Add a factory function to cmLocalGenerator so that variableMappings can be provided from it, and so that Ninja can always have a hard-coded TargetImpLib.
* cmLocalGenerator: Use strings instead of a Target in rule replacementStephen Kelly2016-10-151-2/+5
| | | | Don't rely on the cmGeneratorTarget type needlessly.
* cmLocalGenerator: Use a converter in rule replacement APIStephen Kelly2016-10-151-3/+6
| | | | | | | The rule replacement API should not really be in cmLocalGenerator, but it was historically, and this coupled many other things together here too, such as output conversion. Make the output converter a parameter so that rule replacement can be removed from cmLocalGenerator.
* cmLocalGenerator: Remove the launcher from RuleVariablesStephen Kelly2016-10-151-2/+10
| | | | | | | | | This one is not like the others as it doesn't participate in substitutions. Keep ExpandRuleVariables doing only one thing and make callers responsible for inserting a launcher prefix, simplifying the code all-around. Remove now-obsolete InsertRuleLauncher method.
* Ninja: Fix RC language depfile generation with cmcldepsBen Boeckel2016-10-131-1/+1
| | | | | | | | | | | | | | | | | In commit v3.7.0-rc1~275^2 (Ninja: Use full path for all source files, 2016-08-05), the source path was changed to use an absolute path. Inside of `cmcldeps` for `.rc` file compilation, it uses a separate argument for the path to the source file. This ended up causing `cmcldeps` to transform the following call: cmcldeps.exe RC source.rc ... C:/full/path/to/source.rc into: ... C:/full/path/to//Tc source.rc which is invalid. Update the source filename to use the full path to the source file so that the path is replaced properly.
* Simplify CMake per-source license noticesBrad King2016-09-271-12/+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.
* Ninja: Add source location as include directory for preprocessed filesNils Gladitz2016-09-271-0/+12
| | | | | | | | | | | Fortran INCLUDE statements are not handled by the preprocessor. Since the location of the preprocessed file is distinct from the original source file explicitly add the source file's directory as an include path in the actual compile step (not the preprocessing step) so INCLUDE can find it. Closes: #16332
* Ninja: Add dyndep rules for Fortran module dependenciesBrad King2016-09-221-1/+164
| | | | | Teach the Ninja generator to add dyndep rules and bindings as described in the design comment in `Source/cmGlobalNinjaGenerator.cxx`.
* Ninja: Add explicit preprocessing step for FortranBrad King2016-09-221-1/+165
| | | | | | | | | | All Fortran sources need to be preprocessed before any source may be compiled so that module dependencies can be (later) extracted. Factor out an explicit preprocessing step preceding compilation. Use Ninja depfile dependencies on the preprocessing step and then compile the already-preprocessed source with a separate build statement that depends explicitly only on the preprocessor output. Later we will insert dynamic discovery of module dependencies between these steps.
* cmGlobalNinjaGenerator: Teach WriteBuild about implicit outputsBrad King2016-09-201-2/+3
| | | | | | | | Ninja 1.7 introduced support for implicit outputs on build statements. Teach WriteBuild to generate the corresponding syntax. Leave it up to callers to decide whether implicit outputs are supported by the Ninja version in use. For now simply update all call sites to pass an empty list of implicit outputs.
* fix a batch of include-what-you-use violationsDaniel Pfeifer2016-08-231-0/+8
|
* Ninja: Add `$subdir/{test,install,package}` targetsBrad King2016-08-091-12/+1
| | | | | | | | | | | | | With the Makefile generator one can use `cd $subdir; make install` to build and install targets associated with a given subdirectory. This is not possible to do with the Ninja generator since there is only one `build.ninja` file at the top of the build tree. However, we can approximate it by allowing one to run `ninja $subdir/install` at the top of the tree to build the targets in the corresponding subdirectory and install them. This also makes sense for `test`, `package`, and other GLOBAL_TARGET targets. It was already done for `all` by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all` targets, 2016-03-11).
* Ninja: Use full path for all source filesChaoren Lin2016-08-081-3/+4
| | | | | | This is consistent with the behavior of the Makefile generators. Relative paths are difficult for an IDE to parse the output of a build error.
* Use better KWSys SystemTools::GetEnv and HasEnv signaturesDāvis Mosāns2016-07-181-1/+1
|
* Merge topic 'compiler-features'Brad King2016-06-281-4/+4
|\ | | | | | | | | | | | | | | | | | | 059a6ca0 Merge branch 'unknown-aliased-target' into compiler-features 1d6909a2 use CM_NULLPTR b4b73f56 cxx features: add check for nullptr a7a92390 mark functions with CM_OVERRIDE 9e2d6f0c CM_OVERRIDE: mark destructor overridden in the feature test. 2ca76a66 Validate target name in ALIASED_TARGET property getter
| * use CM_NULLPTRDaniel Pfeifer2016-06-281-4/+4
| |
* | Merge topic 'ninja-no-rsp-for-rc'Brad King2016-06-281-2/+4
|\ \ | |/ |/| | | | | 15b3f6f0 ninja, rc: ignore CMAKE_NINJA_FORCE_RESPONSE_FILE for RC files
| * ninja, rc: ignore CMAKE_NINJA_FORCE_RESPONSE_FILE for RC filesBen Boeckel2016-06-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit v3.6.0-rc1~174^2 (Ninja: Honor CMAKE_NINJA_FORCE_RESPONSE_FILE for compile rules, 2016-04-06), Ninja learned to look for `CMAKE_NINJA_FORCE_RESPONSE_FILE` in the current scope or the environment in order to force response file usage for all compilation rules. However, on Windows, the RC compiler goes through cmcldeps which does a `replace(output, output + ".dep.obj")` on the command line. However, with a response file (which we name `output + ".rsp"`), the response file path is replaced instead causing the compiler to (correctly) complain that the response file `output + ".dep.obj.rsp"` does not exist. What needs to happen is for cmcldeps to look through the response file, replace *its* contents and place it in the `output + ".dep.obj.rsp"` file. Also add a test which actually compiles an RC file into a library and executable for all generators on Windows and additionally test `CMAKE_NINJA_FORCE_RESPONSE_FILE` for Ninja generators. Fixes #16167.
* | Ninja: Make bundle resources a dependency of their targetFlorent Castelli2016-06-231-2/+6
| | | | | | | | Fixes #13816.
* | Refactor Makefile/Ninja tool working directory storageBrad King2016-06-171-1/+1
| | | | | | | | | | Move cmCommonTargetGenerator::WorkingDirectory to cmLocalCommonGenerator and add an access method.
* | Add missing braces around statements.Daniel Pfeifer2016-06-101-8/+16
| | | | | | | | | | Apply fixits of clang-tidy's readability-braces-around-statements checker.
* | Simplify boolean expressionsDaniel Pfeifer2016-06-021-2/+1
|/ | | | | | Use clang-tidy's readability-simplify-boolean-expr checker. After applying the fix-its, revise all changes *very* carefully. Be aware of false positives and invalid changes.
* Merge topic 'improve-character-find-and-replace'Brad King2016-05-251-1/+1
|\ | | | | | | | | | | | | | | 5784747d Improve string find: prefer character overloads. 5cec953e Use std::replace for replacing chars in strings. 2a1a2033 cmExtraEclipseCDT4Generator: use std::replace. 34bc6e1f cmCTestScriptHandler: don't call find repeatedly.
| * Use std::replace for replacing chars in strings.Daniel Pfeifer2016-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | Find uses of `cmSystemTools::ReplaceString` where both `replace` and `with` are string literals with a size of one. Automate with: git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
* | Use enums defined in cmOutputConverter using their fully qualified name.Daniel Pfeifer2016-05-251-6/+6
|/ | | | | | | | | Mostly automated: values=("RelativeRoot" "NONE" "FULL" "HOME" "START" "HOME_OUTPUT" "START_OUTPUT" "OutputFormat" "UNCHANGED" "MAKERULE" "SHELL" "WATCOMQUOTE" "RESPONSE" "FortranFormat" "FortranFormatNone" "FortranFormatFixed" "FortranFormatFree") for i in "${values[@]}"; do git grep -l cmLocalGenerator::$i | xargs sed -i "s|cmLocalGenerator::$i|cmOutputConverter::$i|g"; done
* Ninja: Support embedding of CMake as subninja projectNicolas Despres2016-05-171-4/+6
| | | | | | Add a `CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable. When it is set, CMake generates a `build.ninja` file suitable for embedding into another ninja project potentially generated by an alien generator.
* Ninja: Convert object file names to ninja paths earlierNicolas Despres2016-05-171-4/+6
| | | | | | In WriteObjectBuildStatement we pass object file names and directories to several places that expect paths as Ninja sees them. Convert them to Ninja paths before all such uses.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-331/+223
| | | | | | | | | | | | | 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add options to run clang-tidy with the compilerDaniel Pfeifer2016-04-131-3/+15
| | | | | | Create a <LANG>_CLANG_TIDY target property (initialized by a CMAKE_<LANG>_CLANG_TIDY variable) to specify a clang-tidy command line to be run along with the compiler.
* Ninja: Honor CMAKE_NINJA_FORCE_RESPONSE_FILE for compile rulesDmitry Ivanov2016-04-071-4/+24
|
* cmNinjaTargetGenerator: Factor out helper for forced response file checkDmitry Ivanov2016-04-071-0/+7
|