Xcode 6 introduced an 'OTHER_LIBTOOLFLAGS' setting for the "Other
Librarian Flags" of a static library. Now 'OTHER_LDFLAGS' are ignored.
Teach the Xcode generator to choose the correct name for the build
setting based on the type of target and the version of Xcode.
Inspired-by: Jamie Kirkpatrick <jkp@spotify.com>
Make the virtual 'Generate' method protected. Make 'DoGenerate'
the main entry point to generation. This gives cmGlobalGenerator
a chance to do some early operations before the individual
generator-specific implementations take over.
Delay use of CMAKE_GENERATOR_TOOLSET until the CMakeSystem.cmake
file has been configured and loaded during the first project() or
enable_language() command. This gives the toolchain file named by
CMAKE_TOOLCHAIN_FILE a chance to set CMAKE_GENERATOR_TOOLSET. This
point is still early enough to set the generator toolset prior to
the initialization of any languages that might use the toolset.
The cmake::GeneratorToolset member variable remains an indication
of what was specified by the -T option or loaded from the cache.
It does not need to be updated based on the toolchain file setting.
The cmMakefile::TryCompile can still pass cmake::GeneratorToolset
into the inner instance because the try-compiled project will do
platform and language initialization using the CMakeSystem module
configured for the outer project.
Extend the RunCMake.GeneratorToolset test with cases that use a
toolchain file to set CMAKE_GENERATOR_TOOLSET.
Add source file properties to control Xcode file type attributes:
XCODE_EXPLICIT_FILE_TYPE => explicitFileType
XCODE_LAST_KNOWN_FILE_TYPE => lastKnownFileType
Add a RunCMake.XcodeProject test to verify generated project content.
Implement it in terms of the ComputeObjectFilenames virtual method
on the local generators.
Remove the reimplementation from the global generators which are
now all functionally identical.
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.
The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
When using link_directories() and including CMAKE_CFG_INTDIR,
one can end up with duplicate RPATHs in the binary which
install_name_tool cannot fix without corrupting the binary.
Also, the cmake_install.cmake file has been fixed to correctly
handle these generator specific variables.
All cmGlobalGenerator::GenerateBuildCommand call sites that need to
produce a string now generate "cmake --build" commands. The remaining
call sites immediately pass the result to cmSystemTools::RunSingleCommand.
Avoid the intermediate string and argument parsing by directly producing a
vector of strings. Also drop the ignoreErrors argument because no call
sites remain that use it.
All generators now support detection of the full path to the compiler, so
require it to be so. This will allow CMake<LANG>Information.cmake and
other logic to assume the full path to the compiler tool is available.
The Makefile generators already rejected CMAKE_<LANG>_COMPILER values
that did not name an existing compiler. Extend this error message to
all generators, make it occur as early as possible, and improve the
message with advice about how to set the compiler. If the full path to
the compiler is not known, finish enabling languages with a fatal error
so configuration does not continue.
For now, allow the RC language compiler to not be a full path. Later we
will need to detect the full path to "rc" under the VS IDE.
Add a RunCMake.CompilerNotFound test to cover failure cases.
Fix the RunCMake.CompilerChange test EmptyCompiler case to work
when configuration does not continue past enable_language.
Factor appending of individual flags out into an AppendFlagEscape method
in cmLocalGenerator and teach it to use EscapeForShell. Update all
COMPILE_OPTIONS handling to use AppendFlagEscape.
Override the method in the Xcode generator to use its custom escape
implementation.
Teach the CompileOptions test to add an option that requires escaping
everywhere instead of just with the GNU tools.
Extend the cmGlobalGenerator::GenerateBuildCommand virtual method
signature with a "projectDir" parameter specifying the top of the
project build tree for which the build command will be generated.
Populate it from call sites in cmGlobalGenerator::Build where a
fully-generated build tree should be available.
Rename cmGlobalGenerator::GetCMakeCFG{InitDirectory => IntDir} to
have a shorter name without a typo. Add a 'const' qualifier since
the method is only for lookup and never needs to modify anything.
Remove partial implementation added by commit ca0230a3 (check in initial
conv library stuff, 2007-02-16) since it was never finished. It does
not make sense for multi-configuration generators since no specific
build configuration is processed at CMake time.
Commit 8a0eb78f (Constify many getters of cmGlobalGenerator, 2011-03-26)
added const qualifiers to many cmGlobalGenerator methods. Fix the
signature of the virtual function overrides in cmGlobalXCodeGenerator to
match.
For project and target objects, save their ids in CMakeCache.txt.
Hopefully, that will be enough to allow user settings to be saved
across multiple CMake generate operations. Other object types may
also need their ids saved: if so, more code than this commit
will be necessary...
f09ba0f Fix style errors added by parent and grandparent
eeeeca1 XCode: Support target folders on XCode.
59ed84e Xcode: Support multiple level nesting of XCode folders (#10039)
d0a403f CMake: Move tokenize to cmSystemTools
A post-build phase of each target invokes the XCODE_DEPEND_HELPER.make
file to erase any targets that link to it. Narrow the set of targets
tested by each post-build phase to those that depend on the newly
completed target. This avoids removing files from partially built
unrelated targets that happen to be building in parallel.
Previously the Xcode generator would rerun CMake only if input file
dependencies in the top-level directory changed. Teach it to depend on
input files from all directories. Other generators already do this.
Reported-by: Johan Björk <phb@spotify.com>
This converts the CMake license to a pure 3-clause OSI-approved BSD
License. We drop the previous license clause requiring modified
versions to be plainly marked. We also update the CMake copyright to
cover the full development time range.
Xcode project source file references need to always be relative to the
top of the source tree in order for SCM and debug symbols to work right.
We must even allow the relative paths to cross outside of the top source
or build directories.
For subdirectory project() command Xcode projects we use the source
directory containing the project() command as the top. Relative paths
are generated accordingly for each subproject.
See issue #8481.
This subclass of cmGlobalXCodeGenerator only provided two virtual method
overrides, and it made construction of the Xcode generator instance
complicated. This commit removes it and replaces the virtual methods
with tests of the Xcode version. The change removes duplicate code.
Xcode does not seem to support direct requests for using the linker for
a particular language. It always infers the linker using the languages
in the source files. When no user source files compile with target's
linker language we add one to help Xcode pick the linker.
A typical use case is when a C executable links to a C++ archive. The
executable has no C++ source files but we need to use the C++ linker.
Xcode 2.0 and below supported only one configuration, but 2.1 and above
support multiple configurations. In projects for the latter version we
have been generating a "global" set of buildSettings for each target in
addition to the per-configuration settings. These global settings are
not used by Xcode 2.1 and above, so we should not generate them.
The cmGlobalXCodeGenerator::CreateBuildSettings had the three arguments
productName, productType, and fileType that returned information used by only
one of the call sites. This change refactors that information into separate
methods named accordingly.