CMAKE_SHARED_LIBRARY_<lang>_FLAGS has flags on various platforms for a
variety of purposes that are correlated with shared libraries but not
exclusive to them. Refactor generation of these flags to use new
purpose-specific platform variables
CMAKE_<lang>_COMPILE_OPTIONS_DLL
CMAKE_<lang>_COMPILE_OPTIONS_PIC
CMAKE_<lang>_COMPILE_OPTIONS_PIE
Activate the DLL flags specifically for shared libraries. Add a new
POSITION_INDEPENDENT_CODE target property to activate PIC/PIE flags, and
default to true for shared libraries to preserve default behavior.
Initialize the new property from CMAKE_POSITION_INDEPENDENT_CODE to
allow easy global configuration in projects.
Although the default behavior is unchanged by this refactoring, the new
approach ignores CMAKE_SHARED_LIBRARY_<lang>_FLAGS completely. We must
leave it set in case projects reference the value. Furthermore, if a
project modifies CMAKE_SHARED_LIBRARY_<lang>_FLAGS it expects the new
value to be used. Add policy CMP0018 to handle compatibility with
projects that modify this platform variable.
Add a PositionIndependentCode test on platforms where we can get
meaningful results.
Previously, we were setting the default configuration for a generated
Xcode project to the hard-coded string "Debug" even in cases where users
customized their configuration types such that the list did not contain
"Debug". Now, we use the first string listed in CMAKE_CONFIGURATION_TYPES
as the default config for generated Xcode projects.
0f4dfa6 CPack: Use real path to PackageMaker to find its version file (#12621)
4693cf8 Xcode: Detect new default locations of Xcode 4.3 bits and pieces (#12621)
Treat OBJECT libraries as STATIC libraries. The Xcode project file
format provides no way to avoid running the libtool so hide the
resulting .a away next to the object files as it should never be
referenced. The object files will be left behind for reference by other
targets later.
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.
Xcode 4.3 installs into "/Applications" by default, from the Mac App Store.
Also, the paths to the available SDKs changed: they are now within the
Xcode.app bundle.
PackageMaker is installed as a separate program, and may be installed
anywhere. It is not installed with Xcode 4.3 by default anymore.
Download the "Auxiliary Tools for Xcode" to get PackageMaker.
Put PackageMaker inside the Xcode.app bundle, in its nested Applications
folder, or put it alongside Xcode in "/Applications" and CMake will find
it.
Update references to "find" paths: add new possible locations for finding
Xcode.app and PackageMaker.app. Prefer the most recent version's locations
first, but keep the old locations as fallback search paths, too.
Thanks to all the contributors who provided and tested out various patches
for fixing this issue. Especially, but by no means limited to:
Francisco Requena Espí, Jamie Kirkpatrick and drfrogsplat.
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.
Eliminate callers of cmMakefile::GetIncludeDirectories.
All callers of GetIncludeDirectories should go through the local generator
object.
Only the local generator calls cmTarget::GetIncludeDirectories directly.
Generate the rerun dependency file for the top-level project() and each
subdirectory project() into the corresponding build directory. Do not
clobber them all with the one for the last subproject. This mistake was
left from when the Xcode generator did not produce subprojects.
90efed6 Xcode: Honor Fortran_FORMAT target and source file property
5c0c635 Fortran: Add support for free- and fixed-form flags
47a0c75 VS: Map Fortran free- and fixed-format flags to IDE options
d6e2a06 VS: Map per-source Fortran flags to IDE options
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>
The Makefile, VS, and Xcode generators previously duplicated some custom
command line generation code. Factor this out into a separate class
cmCustomCommandGenerator shared by all generators.
Reverting abandoned topic xcode_source_group_fix_7932 left this source
slightly different due to trailing whitespace removal on some lines.
Remove all trailing whitespace from the file to make it consistent.
With CMAKE_OSX_ARCHITECTURE settings such as $(ARCHS_STANDARD_32BIT),
the space inserted by the for loop would confuse Xcode if quoted. In
this particular example, what would be output would be:
ARCHS = "$(ARCHS_STANDARD_32BIT) ";
The Xcode UI does not recognize this as the built-in "Standards 32-bit"
architecture setting unless the space is removed.
Factor out reading of CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE
into cmMakefile::GetConfigurations. Read the former only in
multi-config generators.
The LINK_FLAGS property is defined only for targets that really link.
These include executables and shared libraries. For static libraries we
define the STATIC_LIBRARY_FLAGS property. Teach the Xcode generator to
make this distinction.
Previously the Xcode generator set SYMROOT to be the target output
directory. This told Xcode to put the "<proj>.build" directory in the
output path too.
This commit sets SYMROOT, CONFIGURATION_BUILD_DIR, and OBJROOT to put
intermediate files in the build directory corresponding to the source
directory that created each target. This is more consistent with the VS
IDE generators. Now only the build output files (actual targets) go to
the target output directory.
The commit "Set version info for shared libs on OSX" taught the Xcode
generator to honor VERSION and SOVERSION properties. However, it also
set version '1.0.0' as the default when no version property is set,
which is inconsistent with the Makefiles generator. This commit fixes
the default to '0.0.0' for consistency.
See issue #9773.
Intel Fortran on Mac OS X enables Fortran support in Xcode. This commit
teaches CMake to associate Fortran sources properly in Xcode projects.
See issue #9739.
The CMAKE_OSX_ARCHITECTURES variable works only as a global setting.
This commit defines target properties
OSX_ARCHITECTURES
OSX_ARCHITECTURES_<CONFIG>
to specify OS X architectures on a per-target and per-configuration
basis. See issue #8725.
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 1.5 writes helper scripts at the projectDirPath location for
targets that do not set SYMROOT. We now add SYMROOT to custom targets
so that all targets set it. This prevents Xcode 1.5 from touching the
source directory now that we always set projectDirPath.
See issue #8481.
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.
This passes the build configuration to most GetLinkerLanguage calls. In
the future the linker language will account for targets linked in each
configuration.
This simplifies computation of the lastKnownFileType attribute for
header files in Xcode projects. We now use a fixed mapping from
header file extension to attribute value. The value is just a hint to
the Xcode editor, so computing the target linker language is overkill.
This method previously required the global generator to be passed, but
that was left from before cmTarget had its Makefile member. Now the
global generator can be retrieved automatically, so we can drop the
method argument.
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.
Previously we named Xcode targets using the output file name from one of the
configurations. This is not very friendly, especially because it changes with
CMAKE_BUILD_TYPE. Instead we should use the original logical target names for
the Xcode target names. This is also consistent with the way the other IDE
generators work.
CMake previously generated Xcode project files labeled as 2.4-compatible
by recent versions of Xcode (3.0 and 3.1). It is better to generate
native Xcode 3.0 and 3.1 projects. In particular, this can improve
build times by using the "Build independent targets in parallel"
feature.
Patch from Doug Gregor. See issue #9216.
Long ago the native build system generators needed HEADER_FILE_ONLY to
be set on header files to stop them from building. The modern
generators correctly handle headers without the help of this property.
This removes automatic setting of the property so that it can be used
reliably as an indicator of project author intention. It fixes VS IDE
project files to show header files normally instead of excluded (broken
by the fix for issue #7845).
Previously cmTarget::GetLocation and cmTarget::GetFullPath would return
for Mac AppBundles the top-level bundle directory but without the .app
extension. We worked around this at the call sites. This fixes the
methods and removes the work-arounds. See issue #8406.
In cmGlobalGenerator we use cmComputeTargetDepends to construct a safe,
non-circular set of inter-target dependencies. This change enables use
of the results by the Xcode generator. It also removes a lot of old
code and another use of the old-style linking logic. See issue #7652.
A Mac OS X Framework should provide a Resources/Info.plist file
containing meta-data about the framework. This change generates a
default Info.plist for frameworks and provides an interface for users to
customize it.
This change cleans up the implementation of cmXCodeObject to avoid
un-escaping and re-escaping string values. There is no need to store
the string in escaped form. It can be escaped once when it is printed
out to the generated project file.
- The Info.plist file in app bundles should not be built.
- User-specified files such as foo.txt should not be built.
- Only files with a recognized language should be built,
just as in the Makefiles generators.
- See bug #7277.
- Generated Xcode projects for application bundles list the
CMake-generated Info.plist input file as a resource.
- The location of the input file was moved by a previous commit,
but the reference to it as a resource file was not updated.
- This change moves the file to CMakeFiles/<tgt>.dir/Info.plist
to give it a more intuitive name in the Xcode project.
- We also update the reference to point at the correct location.
- See bug #7277.
- The Xcode generator creates one Info.plist input file which is
converted at build time by Xcode and placed in the final bundle.
- The <CONFIG>_OUTPUT_NAME target property can place different content
for the exe name in Info.plist on a per-configuration basis.
- Instead of generating a per-config Info.plist input file just let
Xcode put the name in at build time using the $(EXECUTABLE_NAME) var.
- Place the built library in foo.framework/Versions/A/foo
- Do not create unused content symlinks (like PrivateHeaders)
- Do not use VERSION/SOVERSION properties for frameworks
- Make cmTarget::GetDirectory return by value
- Remove the foo.framework part from cmTarget::GetDirectory
- Correct install_name construction and conversion on install
- Fix MACOSX_PACKAGE_LOCATION under Xcode to use the
Versions/<version> directory for frameworks
- Update the Framework test to try these things
- Imported frameworks have the FRAMEWORK property set
- Added cmTarget::IsFrameworkOnApple method to simplify checks
- Also remove separate IMPORTED_ENABLE_EXPORTS property and just use ENABLE_EXPORTS since, like FRAMEWORK, it just represents the target type.
- Document FRAMEWORK keyword in INSTALL command.
- Updated IMPORTED_LOCATION property documentation for Frameworks
- Created cmExportFileGenerator hierarchy to implement export file generation
- Installed exports use per-config import files loaded by a central one.
- Include soname of shared libraries in import information
- Renamed PREFIX to NAMESPACE in INSTALL(EXPORT) and EXPORT() commands
- Move addition of CMAKE_INSTALL_PREFIX to destinations to install generators
- Import files compute the installation prefix relative to their location when loaded
- Add mapping of importer configurations to importee configurations
- Rename IMPORT targets to IMPORTED targets to distinguish from windows import libraries
- Scope IMPORTED targets within directories to isolate them
- Place all properties created by import files in the IMPORTED namespace
- Document INSTALL(EXPORT) and EXPORT() commands.
- Document IMPORTED signature of add_executable and add_library
- Enable finding of imported targets in cmComputeLinkDepends
- This is purely an implementation improvement. No interface has changed.
- Create cmComputeLinkInformation class
- Move and re-implement logic from:
cmLocalGenerator::ComputeLinkInformation
cmOrderLinkDirectories
- Link libraries to targets with their full path (if it is known)
- Dirs specified with link_directories command still added with -L
- Make link type specific to library names without paths
(name libfoo.a without path becomes -Wl,-Bstatic -lfoo)
- Make directory ordering specific to a runtime path computation feature
(look for conflicting SONAMEs instead of library names)
- Implement proper rpath support on HP-UX and AIX.
something like this:
ENABLE_LANGUAGE(ASM-ATT)
IF(CMAKE_ASM-ATT_COMPILER_WORKS)
... do assembler stufff
ELSE(CMAKE_ASM-ATT_COMPILER_WORKS)
... fallback to generic C/C++
ENDIF(CMAKE_ASM-ATT_COMPILER_WORKS)
Alex
CMake-SourceFile2-bp and CMake-SourceFile2-b-mp1 to trunk. This
commit is surrounded by tags CMake-SourceFile2-b-mp1-pre and
CMake-SourceFile2-b-mp1-post on the trunk.
The changes re-implement cmSourceFile and the use of it to allow
instances to be created much earlier. The use of cmSourceFileLocation
allows locating a source file referenced by a user to be much simpler
and more robust. The two SetName methods are no longer needed so some
duplicate code has been removed. The strange "SourceName" stuff is
gone. Code that created cmSourceFile instances on the stack and then
sent them to cmMakefile::AddSource has been simplified and converted
to getting cmSourceFile instances from cmMakefile. The CPluginAPI has
preserved the old API through a compatibility interface.
Source lists are gone. Targets now get real instances of cmSourceFile
right away instead of storing a list of strings until the final pass.
TraceVSDependencies has been re-written to avoid the use of
SourceName. It is now called TraceDependencies since it is not just
for VS. It is now implemented with a helper object which makes the
code simpler.
"imported" executable target. This can then be used e.g. with
ADD_CUSTOM_COMMAND() to generate stuff. It adds a second container for
"imported" targets, and FindTarget() now takes an additional argument bool
useImportedTargets to specify whether you also want to search in the
imported targets or only in the "normal" targets.
Alex