summaryrefslogtreecommitdiffstats
path: root/Source/cmExportFileGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* clang-tidy: fix warnings from version 7Regina Pfeifer2018-11-201-1/+1
| | | | | Fix some warnings that are new since clang-tidy version 4, and update `.clang-tidy` to suppress the rest.
* CSharp: Fix regression in VS project type selection for custom targetBrad King2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | A target created by `add_custom_target` should always be a `.vcxproj` file even if it has `.cs` sources involved in custom commands and such. The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7 (remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget, 2018-03-19). The reason is that the `HasLanguage` method added by commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages(), 2018-03-19) does not check the target type and so is not a suitable check for deciding the project file extension. The `HasLanguage` method was an attempt at an abstraction that turns out not to work very well. Replace it with a dedicated `IsCSharpOnly` method that considers the target type, sources, and non-transitive `LINKER_LANGUAGE`. Fixes: #18515
* LINK_DIRECTORIES: Add new properties and commandsMarc Chevrier2018-09-251-0/+31
| | | | | | | | | | | | These new capabilities enable to manage link directories Two new properties: * target properties: LINK_DIRECTORIES and INTERFACE_LINK_DIRECTORIES One new command * target_link_directories(): to populate target properties Fixes: #17215
* Merge topic 'getsafedef-stdstring'Brad King2018-09-181-1/+1
|\ | | | | | | | | | | | | f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const& Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2350
| * cmMakefile: Make GetSafeDefinition return std::string const&Vitaly Stakhovsky2018-09-181-1/+1
| |
* | cmExportFileGenerator: Use cmGeneratorTarget::ResolveTargetReferenceBrad King2018-09-121-2/+7
|/ | | | Avoid calling `FindGeneratorTargetToUse` directly.
* cmLinkItem: Convert to a "sum type" over a string and target pointerBrad King2018-09-071-1/+11
| | | | | | | | | Avoid exposing the item name implicitly as std::string. When the item is a target, avoid storing a second copy of its name. Most link item construction is paired with calls to `FindTargetToLink` to get the possible target pointer. Rename these methods to `ResolveLinkItem` and refactor them to construct the entire item.
* Merge topic 'export-properties-undefined'Craig Scott2018-08-181-0/+5
|\ | | | | | | | | | | | | | | dbd3e2c53d EXPORT_PROPERTIES: Prevent null dereference for undefined property b88bf6796e EXPORT_PROPERTIES: Add test for an undefined property Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2294
| * EXPORT_PROPERTIES: Prevent null dereference for undefined propertyCraig Scott2018-08-161-0/+5
| | | | | | Fixes: #18260
* | 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-0/+31
|/ | | | Fixes: #17997
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-4/+6
| | | | | | | | | | | | 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.
* cmExportFileGenerator: set IMPORTED_COMMON_LANGUAGE_RUNTIME for CSharp targetMichael Stürmer2018-04-231-2/+7
|
* cmExportFileGenerator: add target property for managed targetsMichael Stürmer2018-04-051-0/+14
|
* Export: allow exporting of additional propertiesWouter Klouwen2018-03-161-0/+40
| | | | | | | | | This change introduces an additional property that may be set on a target to allow additional properties to be exported. Normally only a limited number of properties are exported. Additional properties may be exported by simply setting the `EXPORT_PROPERTIES` property on a target that is exported.
* install,export: Maybe transform OBJECT libraries to INTERFACE librariesBrad King2018-02-281-2/+4
| | | | | | | | | | | Teach the `install` and `export` commands to support installing and exporting `OBJECT` libraries without their object files. Transform them to `INTERFACE` libraries in such cases. For `install(TARGETS)`, activate this when no destination for the object files is specified. For `export`, activate this only under Xcode with multiple architectures when we have no well-defined object file locations to give to clients.
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-10/+12
| | | | | | | | | | * 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.
* Fix trivial typos in textluzpaz2017-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some are user facing. Found using codespell -q 3 --skip="./Utilities" -I .cmake-whitelist.txt` whereby the whitelist contained: ans dum helpfull emmited emmitted buil iff isnt nto ot pathes substract te todays upto whitespaces
* Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-251-8/+7
| | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>
* Meta: replace empty-string assignments with `clear()`.Pavel Solodovnikov2017-09-151-6/+6
|
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-53/+43
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* Provide and use CM_FALLTHROUGHDaniel Pfeifer2017-06-031-0/+1
|
* Access string npos without instancePavel Solodovnikov2017-06-011-10/+11
|
* Allow OBJECT libraries to be installed, exported, and importedRobert Maynard2017-04-181-0/+8
| | | | | | | | Teach install() and export() to handle the actual object files. Disallow this on Xcode with multiple architectures because it still cannot be cleanly supported there. Co-Author: Brad King <brad.king@kitware.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'
* cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-9/+9
|
* 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.
* Export: Factor out file generation steps into helpersBill Hoffman2016-09-081-18/+27
| | | | | Do not actually generate any content in the driving code paths. Use helpers for that.
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-4/+9
|
* Make sure unnused parameters are /*named*/Daniel Pfeifer2016-08-161-1/+1
|
* Do not place CMake version in export filesChristoph Grüninger2016-07-111-1/+1
| | | | | | | Files generated by `install(EXPORT)` and `export_library_dependencies()` may be installed with packages and consumed by dependents. In order to avoid re-building dependents only because the version of CMake changed, drop the CMake version from the export file content.
* Avoid using KWSys auto_ptr by adopting it ourselvesBrad King2016-06-291-5/+5
| | | | | | | | | | | | Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to our own implementation adopted from the KWSys auto_ptr implementation. Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers that do not warn about it. Automate the client site conversions: git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \ 's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
* Improve string find: prefer character overloads.Daniel Pfeifer2016-05-241-4/+4
| | | | | Apply fix-its from clang-tidy's performance-faster-string-find checker. Ignore findings in kwsys.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-537/+370
| | | | | | | | | | | | | 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-36/+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.
* Merge topic 'clang-format-prep'Brad King2016-05-091-0/+22
|\ | | | | | | | | | | | | afca3735 Help clang-format wrap after braces on long initializer lists 85425a3e Move comments off of class access specifier lines 64b55203 Isolate formatted streaming blocks with clang-format off/on
| * Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix export file variable pollutionMatthew Woehlke2016-05-051-0/+3
|/ | | | | | | Add missing unset of scratch variables to generated export file for case that the file was already included. We already unset these when parsing the file normally, but the multiple inclusion case was leaving them around.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix export of STATIC library PRIVATE non-target dependenciesBrad King2016-02-171-0/+21
| | | | | | | | | | | | | | | | | | | In commit v3.5.0-rc1~43^2 (Fix export of STATIC library PRIVATE dependencies with CMP0022 NEW, 2016-01-15) we taught target_link_libraries to generate `$<LINK_ONLY:$<TARGET_NAME:dep>>` in INTERFACE_LINK_LIBRARIES instead of `$<LINK_ONLY:dep>` so that `dep` can be recognized as a target name and updated during export. However, this approach does not work when `dep` is just a plain library name and not a target because `$<TARGET_NAME:...>` requires the name of a reachable target. Since we do not know during target_link_libraries whether the name will correspond to a reachable target or not, we cannot inject the `$<TARGET_NAME:...>` expression. Revert this change and solve the original problem instead by teaching the export logic to recognize and update target names directly in `$<LINK_ONLY:...>` expressions. Reported-by: Ben Boeckel <ben.boeckel@kitware.com>
* Export: Use existing IsDLLPlatform porcelainStephen Kelly2015-10-271-4/+1
|
* Use cmLocalGenerator at generate-time.Stephen Kelly2015-10-241-6/+6
|
* Access policy status from cmGeneratorTarget at generate time.Stephen Kelly2015-10-201-6/+4
|
* cmGeneratorTarget: Copy IsExecutableWithExports from cmTarget.Stephen Kelly2015-10-201-1/+1
|
* cmGeneratorTarget: Move IsCFBundleOnApple from cmTarget.Stephen Kelly2015-10-191-1/+1
|
* cmGeneratorTarget: Copy IsAppBundleOnApple from cmTarget.Stephen Kelly2015-10-191-1/+1
| | | | Leave the cmTarget method behind for now to implement cmInstallCommand.
* cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.Stephen Kelly2015-10-191-1/+1
| | | | Leave the cmTarget method behind for now to implement cmInstallCommand.
* cmGeneratorTarget: Move IsLinkable from cmTarget.Stephen Kelly2015-10-191-1/+1
|
* cmGeneratorTarget: Move GetExportName from cmTarget.Stephen Kelly2015-10-181-6/+5
|