1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-19 11:31:30 +08:00

698 Commits

Author SHA1 Message Date
Brad King
cb6229b8b8 clang-tidy: fix warnings in macOS-only code 2018-11-27 13:20:34 -05:00
Marc Chevrier
c4b4d8b3a6 POSITION_INDEPENDENT_CODE: Manage link flags for executables
Fixes: #14983, #16561
2018-11-11 17:34:09 +01:00
Cengizhan Pasaoglu
c67ab22cdc Using front() and back() instead of calculations 2018-11-06 21:43:33 +03:00
Vitaly Stakhovsky
b8bb6ba653 cmGeneratorTarget::GetExportMacro: return const std::string* 2018-10-16 11:12:19 -04:00
Brad King
1b57f49586 genex: Simplify cmGeneratorExpressionInterpreter
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.
2018-09-07 09:23:43 -04:00
Brad King
d879999534 Merge topic 'genex-evaluate-stdstring'
65ab9ce938 Genex: Return Evaluate results as const std::string&

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2314
2018-08-30 09:18:58 -04:00
Vitaly Stakhovsky
65ab9ce938 Genex: Return Evaluate results as const std::string&
Also remove unused overloads.
2018-08-28 13:56:29 -04:00
Brad King
9da844d8cb Merge topic 'lg-directory'
50fbfee3a0 cmLocalGenerator: return directories as const std::string&

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2309
2018-08-28 13:43:48 -04:00
Vitaly Stakhovsky
50fbfee3a0 cmLocalGenerator: return directories as const std::string& 2018-08-27 15:48:57 -04:00
Marc Chevrier
974de0e199 static library: add property STATIC_LIBRARY_OPTIONS
issue: #18251
2018-08-15 15:20:18 +02:00
Brad King
fb45559e09 Xcode: Process targets in depth-first order during generation
The Xcode 10 "new build system" requires more strict handling of custom
commands.  It may need a fix similar to what commit v3.12.0-rc1~171^2
(VS: Generate a custom command only in the least dependent target,
2018-03-23) did for VS.  Prepare for this by generating targets within
each local generator in dependency order.

Issue: #18070
2018-07-19 13:40:54 -04:00
Brad King
0bad9eba46 Xcode: Refactor storage of ordered list of targets
Sort the resulting Xcode object list so that the actual order of
generation does not matter.
2018-07-19 13:20:28 -04:00
Brad King
d0de296e50 Xcode: Factor target generation loop body into helper method 2018-07-19 13:20:28 -04:00
Brad King
30e27b4110 Xcode: Compute global order index for targets
Compute an index for each target in a global ordering such that no
target comes before its dependencies.
2018-07-19 13:20:28 -04:00
Brad King
e3469a5920 Xcode: Remove loop over local generators that has no effect
Remove a loop over local generators whose body was dropped long ago by
commit v2.6.0~1677 (Remove unused build rules from Xcode, 2007-05-28).
2018-07-19 13:20:27 -04:00
Brad King
e11f660ae1 Merge topic 'xcode-10-legacy-build-system'
ca69206893 Tests: Do not use i386 architecture with Xcode 10 and above
71fa78ff7a Tests: Teach RunCMake to ignore Xcode missing file type warnings
057ecb8f6f C++ feature checks: Ignore Xcode warnings
985d3a162c Xcode: Use legacy build system

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2151
2018-06-20 09:42:25 -04:00
Gregor Jasny
985d3a162c Xcode: Use legacy build system
Closes: #18099
2018-06-19 10:56:50 -04:00
Brad King
e893c53b8c Merge topic 'xcode-10-archs'
bc5bcad45e Xcode: Detect architecture(s) using ARCHS instead of CURRENT_ARCH

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2153
2018-06-19 10:54:28 -04:00
Brad King
bc5bcad45e Xcode: Detect architecture(s) using ARCHS instead of CURRENT_ARCH
Xcode 10 no longer populates `CURRENT_ARCH` with the current
architecture in shell scripts and instead uses `undefined_arch`.
Instead we must use `ARCHS`.  It lists all architectures separated by
spaces.

Fixes: #18085
2018-06-18 13:44:43 -04:00
Marc Chevrier
c1f5a44b28 LINK_OPTIONS: Add new family of properties
This family enable to manage link flags

Three new properties:
* directory property: LINK_OPTIONS
* target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS

Two new commands
* add_link_options(): to populate directory property
* target_link_options(): to populate target properties

Fixes: #16543
2018-06-06 17:22:39 +02:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
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.
2018-06-01 09:53:42 -04:00
Florian Maushart
1ab3881ec9 cmake: Add options for parallel builds to --build mode
While we already support `cmake --build . -- -j`, the options after `--`
are specific to the native build tool.  Add new options `--parallel
[<N>]` and `-j [<N>]` to abstract this and map to the proper option
for the native build tool.
2018-05-25 09:42:20 -04:00
Brad King
0a122393d7 Merge branch 'backport-fix-explicit-CMakeLists.txt' 2018-04-13 09:46:54 -04:00
Brad King
8480c2afc0 Restore support for explicitly referenced CMakeLists.txt sources
Since commit v3.11.0-rc1~467^2 (VS,Xcode: Add CMakeLists.txt sources
without mutating targets, 2017-10-18) we do not add `CMakeLists.txt` to
target sources but instead generate references to them directly.  This
broke projects that explicitly specify their `CMakeLists.txt` file as a
source file because the explicit entry is no longer consolidated with
the generated one.

Teach the relevant generators to avoid duplicating `CMakeLists.txt`
source references and add test cases.

Fixes: #17828
2018-04-13 09:41:06 -04:00
Shane Parris
3f4b81f540 Add glob verify support to XCode, VS, Ninja, and Makefile generators 2018-04-01 23:16:12 -04:00
Brad King
bdbee54a83 Merge topic 'genex-COMPILE_LANGUAGE-system-include'
1b5e52fd65 Genex: Fix COMPILE_LANGUAGE propagation through try_compile
2deb9b7f34 Genex: Fix COMPILE_LANGUAGE in SYSTEM include directories

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1844
2018-03-13 13:42:45 -04:00
Brad King
2deb9b7f34 Genex: Fix COMPILE_LANGUAGE in SYSTEM include directories
When evaluating `INTERFACE_SYSTEM_INCLUDE_DIRECTORIES`, or evaluating
`INTERFACE_INCLUDE_DIRECTORIES` on an imported target, thread the
compile language through to the generator expression evaluator so
that it can support `$<COMPILE_LANGUAGE:...>`.

Fixes: #17811
2018-03-12 11:45:01 -04:00
Shane Parris
0a21d820d3 Remove c_str() from calls to converttorelativeformake in XCode Generator 2018-02-28 09:51:42 -05:00
Shane Parris
b6ef4bc329 Document and extend the CMAKE_SUPPRESS_REGENERATION variable
Fixes: https://gitlab.kitware.com/cmake/cmake/issues/16815
2018-02-23 11:20:15 -05:00
Gregor Jasny
481420ee89 Xcode: Generate ZERO_CHECK generator target only once
In case CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY has been enabled
generate only the root-level ZERO_CHECK target so targets in
subdirectories pick up the root generator target of ZERO_CHECK.

For the case that CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY is not
enabled more investigation and a proper and final fix is still needed.

Issue: 14297
2018-02-22 21:15:48 +01:00
Gregor Jasny
4349393d1d cmGlobalXCodeGenerator: Properly initialize TARGETS variable
Fixes: #17711
2018-02-13 11:02:24 -05:00
Pavel Solodovnikov
653b894683 Reduce raw string pointers usage.
* 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.
2018-01-31 18:23:03 +03:00
Brad King
20ca9d8f6f cmGlobalXCodeGenerator: Avoid -Wconditional-uninitialized warning
Clang incorrectly warns about a case where we initialize a variable
inside a condition in such a way that it will always be initialized
before we use it.  Simply initialize the variable when defining it to
silence the warning.
2018-01-29 09:21:46 -05:00
Marc Chevrier
0448311179 sourceFile properties: add property INCLUDE_DIRECTORIES 2018-01-24 15:10:10 +01:00
Marc Chevrier
78b1c2e09e sourceFile properties: add property COMPILE_OPTIONS
Add the support of per-source property COMPILE_OPTIONS,
including generator expressions support.

Related: #17507
2018-01-23 10:24:56 +01:00
Marc Chevrier
3f935e690a LocalGenerator: refactoring
Introduce method AppendCompileOptions to support
future source file property COMPILE_OPTIONS.
2018-01-23 10:24:47 +01:00
Brad King
506fda1cf0 Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based
on the linker language.  By default this is always the C++ flags if any
C++ sources appear in the target, and otherwise the C flags.  Therefore
we can define the `COMPILE_LANGUAGE` generator expression in
`INCLUDE_DIRECTORIES` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
and Xcode can do.  It is also sufficient for many use cases since the
set of include directories for C and C++ is frequently similar but may
be distinct from those for other languages like CUDA.

Fixes: #17435
2018-01-12 14:27:37 -05:00
Brad King
c2f79c9867 Genex: Enable COMPILE_LANGUAGE for COMPILE_DEFINITIONS with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based
on the linker language.  By default this is always the C++ flags if any
C++ sources appear in the target, and otherwise the C flags.  Therefore
we can define the `COMPILE_LANGUAGE` generator expression in
`COMPILE_DEFINITIONS` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
and Xcode can do.  It is also sufficient for many use cases since the
set of definitions for C and C++ is frequently similar but may be
distinct from those for other languages like CUDA.

Issue: #17435
2018-01-12 14:27:37 -05:00
Brad King
a3bba2a5ad Merge topic '17431-iphone-deployment-target'
4017bf40 Darwin: Emit deployment target that matches the SDK
8f4663ff Xcode: rename embedded SDK query function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1447
2018-01-08 09:58:11 -05:00
Luz Paz
3ab7bf8285 Various typo fixes
Some are user-facing. Others are source comments.
2018-01-04 06:52:01 +11:00
Gregor Jasny
4017bf40de Darwin: Emit deployment target that matches the SDK
Closes: #17431
2017-12-22 21:56:53 +01:00
Gregor Jasny
8f4663ffb2 Xcode: rename embedded SDK query function 2017-12-22 21:56:53 +01:00
Marc Chevrier
10f58b27ac Genex: Per-source $<COMPILE_LANGUAGE:...> support
Fixes: #17542
2017-12-13 16:35:22 +01:00
Marc Chevrier
9432f686e6 Add generator expression support to per-source COMPILE_DEFINITIONS
This allows users to specify different genex-based compile definitions for each file in a target.

Fixes: #17508
2017-12-05 14:47:39 +01:00
Marc Chevrier
6bffc13ef1 Refactor per-source generator expression evaluation
Prepare to add generator expression support to more source properties.
Factor out some duplicated code into a helper to avoid further
duplication.
2017-12-04 09:10:09 -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
Brad King
c871446abc cmSourceGroup: Return strings from GetName and GetFullName 2017-11-15 10:47:07 -05:00
Brad King
8203895caa Merge topic 'xcode64'
23dd8b9e cmGlobalXCodeGenerator: Support XCTest for XCode 6.4

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1471
2017-11-14 07:22:42 -05:00
Craig Scott
98cbcedd74 Xcode: use ranged for loops, cleanup existing for loops
The changes are mostly converting old-style explicit iterator for loops
into ranged for statements. A number of for loops had already been
changed over, but local variables had been left behind instead of being
absorbed into the ranged for statement, so these have been cleaned up
too. A couple of minor improvements were made in areas already being
updated by the for loop changes to slightly simplify the code or to
avoid unnecessary conversions between `const char*` and `std::string`.
2017-11-10 13:12:57 +08:00
Benito Palacios Sanchez
23dd8b9e93
cmGlobalXCodeGenerator: Support XCTest for XCode 6.4 2017-11-09 17:49:36 +01:00