Commit Graph

163 Commits

Author SHA1 Message Date
Vitaly Stakhovsky
92c7b52607 VS: Use range-based 'for' loops in generator code
Use `auto` for complex types.
2017-12-21 14:52:49 -05:00
Justin Goshi
afd9a339a1 server: return whether or not a target is generator provided
Some generators auto-generate targets. For example VS generators create
the ALL_BUILD target. Add the ability to mark targets as generator
provided and return that info through cmake-server codemodel.
2017-11-20 14:29:50 -05:00
luzpaz
777e87ae00 Fix trivial typos in text
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
2017-11-03 10:25:05 -04:00
Brad King
7c28081c14 Merge topic 'string-clear'
5db3aac1 Meta: replace empty-string assignments with `clear()`.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1276
2017-09-19 08:27:00 -04:00
Pavel Solodovnikov
5db3aac111 Meta: replace empty-string assignments with clear(). 2017-09-16 02:26:49 +03:00
Brad King
0b33aee48b Use C++11 override instead of CM_OVERRIDE
We now require C++11 support including `override`.  Drop use of
the old compatibility macro.  Convert references as follows:

    git grep -l CM_OVERRIDE -- '*.h' '*.hxx' '*.cxx' |
      xargs sed -i 's/CM_OVERRIDE/override/g'
2017-09-15 10:06:41 -04:00
Brad King
64e973e991 Merge branch 'backport-vs-fix-config-map' into vs-fix-config-map 2017-09-13 09:43:24 -04:00
Brad King
c5b5bb270f VS: Do not consider MAP_IMPORTED_CONFIG_<CONFIG> on non-imported targets
Since commit v3.9.0-rc1~309^2 (include_external_msproject: Honor
MAP_IMPORTED_CONFIG_<CONFIG>, 2017-04-04) we accidentally honor
`MAP_IMPORTED_CONFIG_<CONFIG>` while generating the `.sln` file entries
for normal targets.  This causes `devenv.com`-driven builds to use the
mapping incorrectly for normal targets.  Check that a target really
comes from `include_external_msproject` before considering the map.

Furthermore, when we do use the map, we should only take the first entry
if more than one configuration is specified.  Otherwise we end up giving
VS a configuration name with a `;` in it.

Fixes: #17276
2017-09-13 09:37:30 -04:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Aaron Orenstein
7bc6577017 Performance: Fix a few more unnecessary vector copies missed in af3fd6f 2017-08-18 07:59:52 -07:00
Brad King
81f9c9e892 Deprecate Visual Studio 8 2005 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2017-04-21 13:45:45 -04:00
Brad King
6e66fe5f97 cmGlobalVisualStudio8Generator: Drop unused GetDocumentation method
This has been moved to the factory.
2017-04-19 14:45:00 -04:00
Beeble
227de0b95d include_external_msproject: Honor MAP_IMPORTED_CONFIG_<CONFIG>
This allows projects added via `include_external_msproject` to compile
the preferred configuration despite different naming conventions.
2017-04-05 13:44:03 -04:00
Beeble
4cd815f0b3 VS: Pass whole target to WriteProjectConfigurations 2017-04-05 13:37:45 -04:00
Brad King
f8f3cb8d65 VS: Fix quoting of special characters in cmake re-run check commands
Fix our calls to `AddCustomCommandToOutput` for adding cmake re-run
check commands to disable old-style quoting in favor of the full quoting
logic.  This is necessary when paths contain special characters like `&`
that old-style quoting logic does not handle.

This also requires us to expand the `$(SolutionPath)` placeholder
explicitly because otherwise its expanded value will no longer be quoted
correctly.  As a side effect, this fixes the value in VS 10 and above
where the placeholder may be undefined when driving the build through
MSBuild without the `.sln` file.

Reported-by: Steven Cook <sc@harshbutfair.org>
Fixes: #16585
2017-02-06 09:53:15 -05:00
Daniel Pfeifer
66a7099993 iwyu: Fix VisualStudio specific issues 2016-11-28 14:06:40 -05:00
Yves Frederix
427b6da9e5 VS: Teach cmake --build to reconfigure if needed before building
Visual Studio's build system does not cleanly handle itself being
re-generated during the build.  Teach `cmake --build` to check whether
the build system needs to be re-generated before launching the native
build tool.
2016-11-17 13:53:42 -05:00
Stephen Kelly
a49751fb2e cmState: Move TargetType enum to separate namespace 2016-10-19 15:40:58 +02:00
Brad King
86578eccf2 Simplify CMake per-source license notices
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.
2016-09-27 15:14:44 -04:00
Daniel Pfeifer
efed6468ed fix a load of include-what-you-use violations 2016-09-03 08:04:56 -04:00
Tobias Hunger
4db08807db CMake: Report whether generators support platforms 2016-07-14 10:35:58 -04:00
Tobias Hunger
43a68a6dca cmGlobalGeneratorFactory: Use CM_OVERRIDE for all derived classes 2016-07-14 10:35:58 -04:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
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.
2016-05-16 16:05:19 -04:00
Brad King
0ac18d40c8 Remove //------... horizontal separator comments
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.
2016-05-09 09:41:43 -04:00
Brad King
e1c7747253 Format include directive blocks and ordering with clang-format
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>
2016-04-29 13:58:54 -04:00
Brad King
180538c706 Source: Stabilize include order
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.
2016-04-29 13:58:31 -04:00
Brad King
571bedec29 VS: Ignore USE_FOLDER property on VS versions that do not support it
Solution folders are supported on VS 8 and above in the full versions
and on VS 11 and above in the express versions.
2016-04-26 08:22:27 -04:00
Brad King
0c58d2d0fd VS: Detect VS 8 and 9 Express editions 2016-04-26 08:16:19 -04:00
Robert Dailey
2b958a2027 cmake-gui: Add option to specify generator toolset
The -T parameter to CMake may now be specified through cmake-gui via a
new text field in the first-time configure wizard (below the generator
chooser).

The generator factories specify whether or not they support toolsets.
This information is propagated to the Qt code and used to determine if
the selected generator should also display the optional Toolset widgets.
2015-11-17 10:03:10 -05:00
Stephen Kelly
79c3a2a8f7 cmGlobalGenerator: Remove map from cmTarget to cmGeneratorTarget
The configure-time and generate-time types should be completely
independent.

Add ownership of cmGeneratorTarget instances to the cmLocalGenerator.
2015-10-27 07:44:26 +01:00
Stephen Kelly
0c97d32f7a cmGlobalGenerator: Remove direct storage of targets
Find the target by looping when needed.
2015-10-27 07:44:23 +01:00
Stephen Kelly
736c2042c6 cmGeneratorTarget: Add GetUtilities API 2015-10-27 07:44:20 +01:00
Stephen Kelly
6cac952b9e VS: Port interface to cmGeneratorTarget 2015-10-24 09:24:43 +02:00
Stephen Kelly
b13e26e278 VS: Port ProjectDepends to cmGeneratorTarget. 2015-10-24 09:24:30 +02:00
Stephen Kelly
a8c0fbcc19 cmLocalGenerator: Store a vector of generator targets.
Not a map from cmTarget to cmGeneratorTarget.
2015-10-21 23:21:01 +02:00
Stephen Kelly
04b6bb1676 cmLocalGenerator: Simplify semantic of adding generator targets.
Don't store on the global generator as a side effect.  Update clients to adapt.
2015-10-20 23:58:49 +02:00
Stephen Kelly
eac15298a8 cmState: Move TargetType enum from cmTarget.
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
2015-10-15 00:41:39 +02:00
Stephen Kelly
2293d43d00 cmLocalGenerator: Store cmGeneratorTargets.
Relieve cmMakefile of this responsibility.
2015-10-14 13:32:09 -04:00
Stephen Kelly
12cb3bdce4 cmLocalGenerator: Add Home directory accessors.
Reduce reasons for cmLocalGenerator to have a cmMakefile.
2015-10-09 00:00:19 +02:00
Stephen Kelly
af71c7b479 cmTarget: Remove Compute method. 2015-10-07 20:17:55 +02:00
Stephen Kelly
776ff8eb0b cmTarget: Add Compute API for sources.
This method is a refactoring artifact.  It will be removed in a
follow-up.
2015-10-07 08:37:57 +02:00
Stephen Kelly
c38e30f68c cmGeneratorTarget: Add methods for generate-time source addition. 2015-10-07 08:37:57 +02:00
Stephen Kelly
21f428f4c0 VisualStudio: Replace Compute override with AddExtraIDETargets override. 2015-10-05 18:43:18 +02:00
Brad King
03bfe71ae0 VS: Refactor target ordering logic
Refactor cmGlobalVisualStudioGenerator::TargetCompare to store the name of
the target that should come first instead of hard-coding "ALL_BUILD".
Update client sites to specify "ALL_BUILD" when ordering for .sln files
and an empty string otherwise (in cases when "ALL_BUILD" should not be
encountered anyway).
2015-09-22 10:25:58 -04:00
Stephen Kelly
a7f5d70dde cmGeneratorTarget: Move compile defintions processing from cmTarget. 2015-08-26 19:46:30 +02:00
Stephen Kelly
1f54bc1cf3 cmTarget: Split storage of include directories from genexes. 2015-08-07 17:06:15 +02:00
Stephen Kelly
5edb335485 cmGlobalGenerator: Virtualize the Compute step and override it. 2015-07-30 08:28:31 +02:00
Stephen Kelly
ff1019bfac cmGlobalGenerator: Move generation object creation to Compute(). 2015-07-30 08:28:30 +02:00
Stephen Kelly
faec4e611d cmComputeTargetDepends: Change API to use cmGeneratorTarget. 2015-07-01 19:46:19 +02:00
Brad King
d6fe79f3ab Merge topic 'remove-CMAKE_USE_RELATIVE_PATHS'
6e570f85 cmLocalGenerator: Remove 'optional' parameter from Convert.
3d8c6cd9 cmLocalGenerator: Remove obsolete method.
e44e6bcc Port away from obsolete method.
1335992c Remove CMAKE_USE_RELATIVE_PATHS variable.
2015-06-04 09:13:33 -04:00