Commit Graph

287 Commits

Author SHA1 Message Date
Tobias Hunger 3c488ce899 cmLocalGenerator: Adopt target compile flag generation
Factor the flag generation out of cmCommonTargetGenerator::GetFlags
into a new cmLocalGenerator::GetTargetCompileFlags method.
This will allow it to be used without a target generator available.
2016-06-17 14:49:38 -04:00
Brad King 5467e7945d cmLocalGenerator: Add method to get Fortran-specific compiler flags
Add a cmLocalGenerator::GetTargetFortranFlags virtual method to get
generator-specific generation of Fortran-specific flags.  Implement it
in cmLocalCommonGenerator by moving the implementation from
cmCommonTargetGenerator::AddFortranFlags.  This will allow it to be used
without having a target generator available.

Inspired-by: Tobias Hunger <tobias.hunger@qt.io>
2016-06-17 14:49:29 -04:00
Brad King 18e00ac7b9 Merge topic 'avoid-cmMakefile-IssueMessage-after-configure'
ea5324cd cmMakefile: Port messages for compile features to cmake
df8c3130 cmGlobalGenerator: Don't use cmMakefile::IssueMessage after configure
946d1e50 cmMakefile: Avoid IssueMessage after configure is finished
096c7754 cmLocalGenerator: Store Backtrace for the directory
2016-06-13 09:54:24 -04:00
Stephen Kelly 096c7754b3 cmLocalGenerator: Store Backtrace for the directory
Don't rely on cmMakefile to provide that.  Use it to issue messages.
2016-06-12 19:01:45 +02:00
Tobias Hunger f62ed322dc cmLocalGenerator: Add GetTargetDefines to get all defines for a target 2016-06-10 09:24:49 -04:00
Brad King 853b1bb4ba cmLocalGenerator: Constify AppendDefines and AddCompileDefinitions 2016-06-10 09:24:11 -04:00
Tobias Hunger 70d3bf8580 cmLocalGenerator: Adopt GetFrameworkFlags method
Move it from cmCommonTargetGenerator.
2016-06-09 10:39:57 -04:00
Tobias Hunger b0d3e693f1 cmLocalGenerator: Pass configuration to GetTargetFlags
Move the configuration lookup to call sites.  This will allow
multi-configuration callers to use the method.
2016-06-08 16:18:31 -04:00
Daniel Pfeifer 25d1ef6424 Use enums defined in cmOutputConverter using their fully qualified name.
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
2016-05-25 09:20:09 -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
Geoff Viola 5e4287131b GHS: Shorten long object paths with duplicate source names
Detect when the resulting object path is too long and compute an
alternative name using a hash.
2016-05-06 08:21:05 -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 0e44f4894f Rename local target lookup methods to clarify purpose
Rename methods:

* `cmMakefile::Find{ => LocalNonAlias}Target`
* `cmLocalGenerator::Find{ => LocalNonAlias}GeneratorTarget`

These names clarify that they are for directory-local target names
and do not consider alias targets.
2016-04-01 15:44:16 -04:00
Brad King 036b6ef7c4 Port CMake from cmIML to KWIML
KWIML no longer uses a configured prefix.
2015-12-18 10:02:07 -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 c389f8bb07 cmLocalGenerator: Port Find method away from GetGeneratorTarget
Mirror the cmMakefile::FindTarget method.
2015-10-27 07:44:26 +01:00
Stephen Kelly 9b244cc0ec cmLocalGenerator: Store imported targets in a separate container. 2015-10-27 07:44:24 +01:00
Stephen Kelly def6da616b cmLocalGenerator: Port FindGeneratorTarget away from GetGeneratorTarget 2015-10-27 07:44:24 +01:00
Stephen Kelly 00b8c0a8d4 cmLocalGenerator: Add IsRootMakefile API 2015-10-27 07:44:21 +01:00
Stephen Kelly 7d409f500e cmLocalGenerator: Add GetPolicyStatus API 2015-10-27 07:44:21 +01:00
Stephen Kelly a6b7eb5bc8 cmInstallTargetGenerator: Get a cmGeneratorTarget directly.
Extend the cmGeneratorTarget API to make this possible.
2015-10-24 09:19:52 +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 a4bbdc5ecf cmLocalGenerator: Remove cmGeneratorTargetsType from setter API. 2015-10-21 01:18:27 +02:00
Stephen Kelly 37ab74a607 cmLocalGenerator: Port PList handling to cmGeneratorTarget. 2015-10-18 16:29:29 +02:00
Stephen Kelly 31c4aee75a cmLocalGenerator: Port policy handling to cmGeneratorTarget. 2015-10-17 17:30:39 +02:00
Stephen Kelly 3e8ef64273 cmLocalGenerator: Port some API to cmGeneratorTarget. 2015-10-17 17:30:38 +02:00
Stephen Kelly 7f5ec9f109 cmLocalGenerator: Port GetTargetDirectory to cmGeneratorTarget. 2015-10-15 00:33:12 +02:00
Stephen Kelly 2293d43d00 cmLocalGenerator: Store cmGeneratorTargets.
Relieve cmMakefile of this responsibility.
2015-10-14 13:32:09 -04:00
Brad King 762108f3ec Merge topic 'add-cmLocalGenerator-API'
223d0efe Remove some needless GetMakefile() calls.
a367416c cmLocalGenerator: Add current source directory accessor.
bbef3c2d cmLocalGenerator: Add current binary directory accessor.
12cb3bdc cmLocalGenerator: Add Home directory accessors.
72efa15d Eclipse: Port API to cmLocalGenerator.
f2a641d6 Kate: Remove unused variables.
10cf42f5 Kate: Port API to cmLocalGenerator.
e46ef270 export: Port internal method to cmGeneratorTarget.
53d3a1c9 cmMakefile: Remove unused GetProjectName calls.
4ab2750c cmLocalGenerator: Add GetProjectName method.
c8187f41 cmCPluginAPI: Inline code to get project name.
8c6e6dd3 cmMakefile: Inline initialization of project name.
27916f2c cmLocalGenerator: Add cmake instance accessor.
2015-10-12 10:26:15 -04:00
Stephen Kelly a367416cec cmLocalGenerator: Add current source directory accessor. 2015-10-10 11:04:39 +02:00
Stephen Kelly bbef3c2da8 cmLocalGenerator: Add current binary directory accessor. 2015-10-10 11:04:39 +02:00
Stephen Kelly c99b6cefbe cmLocalGenerator: Devirtualize method. 2015-10-09 00:03:40 +02: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 4ab2750c54 cmLocalGenerator: Add GetProjectName method. 2015-10-09 00:00:18 +02:00
Stephen Kelly 27916f2cd1 cmLocalGenerator: Add cmake instance accessor. 2015-10-08 23:25:11 +02:00
Stephen Kelly f7738fd122 cmLocalGenerator: Constify target in API. 2015-10-05 19:22:02 +02:00
Stephen Kelly 8bfff68642 cmLocalGenerator: Compute object max path on construction. 2015-09-24 09:39:39 +02:00
Brad King e134e53b47 Add support for *.manifest source files with MSVC tools
Classify .manifest sources separately, add dependencies on them, and
pass them to the MS manifest tool to merge with linker-generated
manifest files.

Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
2015-09-17 10:21:32 -04:00
Brad King 9a6d7d2e54 Merge topic 'refactor-compute'
616d8f02 cmGeneratorTarget: Rename method to match operation.
ec56d244 cmGlobalGenerator: Process evaluation files after target depends.
1e5349a5 cmGlobalGenerator: Access makefile from makefiles container.
2015-08-31 09:48:30 -04:00
Stephen Kelly 616d8f02d5 cmGeneratorTarget: Rename method to match operation.
The manifest is computed, not generated, according to current language
used in cmake method naming.
2015-08-30 11:39:52 +02:00
Stephen Kelly ff8ac8ee6a cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
2015-08-28 18:44:39 +02:00
Stephen Kelly 9b6a743b80 cmLocalGenerator: Remove Parent pointer. 2015-08-28 18:44:38 +02:00
Stephen Kelly 867b5be8b8 cmLocalGenerator: Remove unused Children member. 2015-08-24 20:05:38 +02:00
Stephen Kelly 6c0e9ee276 cmMakefile: Store EvaluationFiles.
Relieve the cmGlobalGenerator of this responsibility.  Evaluate
the generator expressions in the context of the cmLocalGenerator.
2015-08-01 13:07:11 +02:00
Stephen Kelly bbad6ba537 cmLocalGenerator: Remove unused AddCustomCommandToCreateObject method. 2015-07-27 21:58:48 +02:00
Stephen Kelly e4dc83ade5 cmLocalGenerator: Remove unused AddBuildTargetRule method. 2015-07-27 21:58:47 +02:00
Stephen Kelly 72f43fa13d cmLocalGenerator: Remove CreateCustomTargetsAndCommands method.
It loops over cmGeneratorTargets, but at the point it is called, there are no
cmGeneratorTargets.  This must be dead code.
2015-07-27 21:57:29 +02:00
Brad King c736de7b28 Factor an <INCLUDES> placeholder out of <FLAGS> in rule variables
Teach the Makefile and Ninja generators to substitute for an <INCLUDES>
placeholder instead of putting -I in <FLAGS>.  Update our values for

  CMAKE_<LANG>_COMPILE_OBJECT,
  CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE, and
  CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE

to place <INCLUDES> just before <FLAGS>.
2015-07-13 10:49:46 -04:00
Stephen Kelly 820986edff cmLocalGenerator: Constify GetIncludeDirectories method. 2015-06-21 21:14:09 +02:00