Commit Graph

12569 Commits

Author SHA1 Message Date
Brad King b291d9e756 VS10: Fix external objects generated outside target (#13047)
Commit 9a6ff950 (Fix for bug where VS2010 did not use .obj files,
2011-04-01) assumed that if an external object is GENERATED that it is
the output of a custom command in the current target.  If it is
generated by another target then VS will not automatically include the
external object in the current target.  This bug was preserved by the
refactoring in the parent commit.

Instead use <None> for external objects generated by a custom command in
the current target and <Object> for all other external objects.  Update
the ExternalOBJ test to cover this case.
2012-03-20 09:01:02 -04:00
Brad King 328c0f65c2 Simplify cmVisualStudio10TargetGenerator source classification
Combine WriteCLSources and WriteObjSources into a single method.  Use
the cmGeneratorTarget source classification to simplify tool selection
for each source file.  Extend the classification to handle .idl files.
2012-03-19 17:13:41 -04:00
Brad King 93d5509b5b Merge branch 'ninja-object-library' into object-library
* ninja-object-library: (37 commits)
  Ninja: Honor $<TARGET_OBJECTS:...> source expressions
  Build object library targets in Ninja
  Pre-compute object file names before Ninja generation
  Simplify cmNinjaTargetGenerator using cmGeneratorTarget
  Ninja: Avoid using 'this' in member initializers
  Ninja: Fix for PDB files with spaces in the path.
  Ninja: Constify use of cmCustomCommand
  Ninja: add /DEF: flag to linker call
  Ninja: Add a cache option CMAKE_ENABLE_NINJA to enable the ninja generator.
  Ninja: Add friend struct so it can access the private ConvertToNinjaPath.
  Ninja: add .def file support
  Ninja: ensure the output dir exists at compile time
  Ninja: Remove an unnecessary variable
  Ninja: Use cmSystemTools::ExpandListArgument to split compile/link commands
  Ninja: Add a missed license header
  Ninja: CMake: Adapt Ninja generator for per-target include dirs
  Ninja: windows msvc: create for each target a .pdb file
  Ninja: Import library support for Windows
  Ninja: mark the Windows specific hacks with a comment only
  Ninja: disable unfinished Windows ninja support
  ...
2012-03-19 13:11:27 -04:00
Brad King eb24c99c4d Merge branch 'object-library' into xcode-object-library 2012-03-19 11:53:41 -04:00
David Cole 63d1be8b00 Xcode: Honor $<TARGET_OBJECTS:...> source expressions
Add objects from object libraries referenced using this syntax to the
set of objects linked in a target.
2012-03-19 11:53:29 -04:00
Brad King 020ba38775 Merge branch 'object-library' into xcode-object-library 2012-03-19 11:53:24 -04:00
David Cole e8ea615874 Build object library targets in Xcode
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.
2012-03-19 11:53:04 -04:00
David Cole 8045e17119 Pre-compute object file names before Xcode generation 2012-03-19 11:52:40 -04:00
David Cole 247a132422 Allow txt files as ExtraSources in object library targets
Necessary for the Xcode generator, in which the CMakeLists.txt
files are added as sources merely for convenient access, without
any associated custom command.
2012-03-16 14:25:22 -04:00
David Cole b063599603 Add a default source group for object files. 2012-03-16 14:25:21 -04:00
David Cole be01f3b098 Xcode: Re-factor some existing methods into "FromPath" variants
...to avoid depending on cmSourceFile instances. Prep work for supporting
OBJECT_LIBRARY in the Xcode generator.
2012-03-16 14:23:13 -04:00
Brad King 2693dbe085 Merge branch 'object-library' into ninja-object-library 2012-03-16 10:20:20 -04:00
Brad King 51997cb6dc Ninja: Honor $<TARGET_OBJECTS:...> source expressions
Add objects from object libraries referenced using this syntax to the
set of objects linked in a target.
2012-03-16 10:19:44 -04:00
Brad King 23ec258fce Merge branch 'object-library' into ninja-object-library 2012-03-16 10:19:10 -04:00
Brad King 61124de4c0 Build object library targets in Ninja
Treat OBJECT libraries as STATIC libraries but leave out the archive
step.  The object files will be left behind for reference by other
targets later.
2012-03-16 10:18:36 -04:00
Brad King f5b06cda0f Pre-compute object file names before Ninja generation
Implement cmGlobalGenerator::ComputeTargetObjects in the Ninja generator
to pre-compute all the object file names.  Use the results during
generation instead of re-computing it later.
2012-03-16 10:18:35 -04:00
Brad King a2514f15fa Simplify cmNinjaTargetGenerator using cmGeneratorTarget
Replace the classification of source files in this generator using that
computed by cmGeneratorTarget.
2012-03-16 10:18:35 -04:00
Brad King c68cc06612 Merge branch 'object-library' into ninja-object-library 2012-03-16 10:18:01 -04:00
Brad King 48eb7fc7d7 Ninja: Avoid using 'this' in member initializers
VS complains

 warning C4355: 'this' : used in base member initializer list

so initialize the member in the constructor body instead.
2012-03-16 10:16:55 -04:00
Bill Hoffman bba37dd517 Ninja: Fix for PDB files with spaces in the path.
This calls ConvertToOutputFormat on the PDB paths for pdb file paths
used in both library creation and the building of object files.
2012-03-16 10:16:45 -04:00
Brad King cd146c650e Document OBJECT library type in add_library command
Describe the OBJECT library signature of add_library and the
$<TARGET_OBJECTS:...> expressions needed to use object libraries.
Also document the what is not allowed for object library targets.
2012-03-16 10:12:31 -04:00
Brad King c403f27a2d Add $<TARGET_OBJECTS:...> expression to use an object library
For now do not allow an OBJECT library to reference other object
libraries.  Teach cmTarget::ComputeLinkImplementation to include the
languages of object libraries used by a target.
2012-03-16 10:12:15 -04:00
David Cole 34e4985eed Xcode: Re-factor code into GetObjectsNormalDirectory method
...in preparation for calling it from more than one location.
Required to support OBJECT_LIBRARY targets in Xcode.
2012-03-16 10:05:46 -04:00
Brad King 3a53005f7d Build object library targets in VS
Treat OBJECT libraries as STATIC libraries.  The VS project file format
provides no way to avoid running the librarian so hide the resulting
.lib 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.
2012-03-13 14:38:02 -04:00
Brad King 3aa741acb6 Build object library targets in Makefiles
Treat OBJECT libraries as STATIC libraries but leave out the archive
step.  The object files will be left behind for reference by other
targets later.
2012-03-13 14:38:02 -04:00
Brad King b87d7a60a0 Add OBJECT_LIBRARY target type
This library type can compile sources to object files but does not link
or archive them.  It will be useful to reference from executable and
normal library targets for direct inclusion of object files in them.

Diagnose and reject the following as errors:

* An OBJECT library may not be referenced in target_link_libraries.

* An OBJECT library may contain only compiling sources and supporting
  headers and custom commands.  Other source types that are not normally
  ignored are not allowed.

* An OBJECT library may not have PRE_BUILD, PRE_LINK, or POST_BUILD
  commands.

* An OBJECT library may not be installed, exported, or imported.

Some of these cases may be supported in the future but are not for now.

Teach the VS generator that OBJECT_LIBRARY targets are "linkable" just
like STATIC_LIBRARY targets for the LinkLibraryDependencies behavior.
2012-03-13 14:37:32 -04:00
Brad King ac800f49d0 Ninja: Constify use of cmCustomCommand
The generator never needs to modify custom command instances.
2012-03-13 11:23:14 -04:00
Peter Kuemmel 9a0d5a828a Ninja: add /DEF: flag to linker call 2012-03-13 11:20:29 -04:00
Brad King f737bd416a Pre-compute and store target object directory in cmGeneratorTarget
Add cmGeneratorTarget::ObjectDirectory member to hold the value.  In
ComputeTargetObjects set the value to the full path to the target object
directory including any necessary placeholder for the configuration
name.
2012-03-12 16:44:03 -04:00
Brad King 9c0a00d6dd Rename/constify build-time config placeholder lookup
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.
2012-03-09 15:16:03 -05:00
Brad King 46f4940675 Remove unused cmSourceGroup method
The non-const GetSourceFiles method is not needed.
2012-03-09 15:16:03 -05:00
Brad King d57047de33 Pre-compute object file names before VS project generation
Implement cmGlobalGenerator::ComputeTargetObjects in the VS generator
to pre-compute all the object file names.  Use the results during
generation instead of re-computing it later.
2012-03-09 15:16:02 -05:00
Brad King 3baaf6ccec Pre-compute object file names before Makefile generation
Add a virtual cmGlobalGenerator::ComputeTargetObjects method invoked
during cmGeneratorTarget construction.  Implement it in the Makefile
generator to pre-compute all object file names for each target.  Use
the results during generation instead of re-computing it later.
2012-03-09 15:16:02 -05:00
Brad King 62a841b80b Simplify cmVisualStudio10TargetGenerator using cmGeneratorTarget
Use CustomCommands and ModuleDefinitionFile computed in the latter
instead of recomputing them from the original target source files.
2012-03-09 15:16:02 -05:00
Brad King 45c2f93240 Simplify cmMakefileTargetGenerator using cmGeneratorTarget
Replace the classification of source files in this generator
using that computed by cmGeneratorTarget.
2012-03-09 15:16:02 -05:00
Brad King 4b24558091 Create a cmGeneratorTarget for each cmTarget during generation
Construct the instances after the final set of targets is known but
before computing inter-target dependencies.  This order will allow
initialization of cmGeneratorTarget instances to adjust and finalize
declared inter-target dependencies.
2012-03-09 15:16:02 -05:00
Brad King 11d9b21126 Add cmGeneratorTarget to represent a target during generation
Some per-target information and logic is common to all generators.
Some of that information is currently stored in cmTarget but that
should be reserved for the configure step.  Create a class to hold
per-target information for generators.  On construction classify
sources from the target and store them in separate members.  This
classification is already implemented separately in each generator.
2012-03-09 15:16:02 -05:00
Brad King 51b67366ed Merge branch 'cleanup-object-file-names' into object-library 2012-03-09 15:15:37 -05:00
Bill Hoffman d40eebd89d Ninja: Add a cache option CMAKE_ENABLE_NINJA to enable the ninja generator.
Make the option default to on, for platforms where CMake passes
all tests with the ninja generator.  This is currently only Linux.
2012-03-09 14:28:21 -05:00
KWSys Robot c7bdef5b48 KWSys Nightly Date Stamp 2012-03-09 00:05:04 -05:00
David Cole fa0f065426 Merge topic 'find_package_fatal_error_if_required_and_config_not_found'
c5ae733 find_package: Test that REQUIRED aborts processing correctly
c91a54d find_package: error out if REQUIRED Config has not been found
2012-03-08 15:14:23 -05:00
David Cole da43d8fa8d Merge topic 'MakingConfigFilesEasier_ConfigureMacro'
6973e2d wrap write_basic_config_version_file as write_basic_package_version_file()
204f5d4 add CMakePackageConfigHelpers: configure_package_config_file()
2012-03-08 15:14:12 -05:00
David Cole f55119e63b Merge topic 'fix-12189-support-SBCS-in-VS'
b28e7fa VS6: Avoid SBCS test on VS6 (#12189)
df19b9c VS6: Avoid _MBCS define when _SBCS is defined (#12189)
ba89e92 Visual Studio: Allow setting Single Byte Character Set (#12189)
2012-03-08 15:14:03 -05:00
David Cole 9cdd989667 Merge topic 'fixCPackDocTypo'
b0cb29b Fix some typos in CPACK_SET_DESTDIR doc
2012-03-08 15:13:39 -05:00
David Cole 580171185b Merge topic 'target-include-directories'
d662dff Fix shadowed variable warning on dashboard results
f66e735 Fix compiler warning reported on older Borland dashboard.
d90eed4 Fix compiler error reported on older Borland dashboard.
8233636 Update the documentation regarding INCLUDE_DIRECTORIES.
d899eb7 Call ExpandVariablesInString for each target's INCLUDE_DIRECTORIES
c21db87 Make search paths ordered and unique
22021f0 Remove cmMakefile::GetIncludeDirectories
9106b56 Extract and use the INCLUDE_DIRECTORIES target properties.
840509b Keep the INCLUDE_DIRECTORIES target property up to date.
a4d5f7b Add API to get the ordered includes for a target.
8adaee2 CMake: Eliminate cmMakefile::IncludeDirectories
7620932 Remove include flags memoization.
97a5faa Make it safe to call this method without creating duplicates.
edd5303 Refactor GetIncludeFlags to take includes instead of fetching them
2012-03-08 15:13:15 -05:00
Brad King 0996f2a228 Hide Makefile local object info inside local generator
Make cmLocalUnixMakefileGenerator3::LocalObjectInfo private and add
cmLocalUnixMakefileGenerator3::AddLocalObjectFile to create entries.
2012-03-08 07:58:52 -05:00
KWSys Robot 3a36fa9971 KWSys Nightly Date Stamp 2012-03-08 00:05:06 -05:00
David Cole 8c634330db Ninja: Add friend struct so it can access the private ConvertToNinjaPath.
The HP aCC compiler is apparently more strict than all our other
dashboard compilers with respect to complaining about this.
2012-03-07 16:24:34 -05:00
Peter Kuemmel dbe3dce546 Ninja: add .def file support 2012-03-07 16:24:34 -05:00
Peter Kuemmel f1bb08f55b Ninja: ensure the output dir exists at compile time 2012-03-07 16:24:33 -05:00