Commit Graph

66 Commits

Author SHA1 Message Date
Brad King ad91d0edd5 Merge topic 'auto_export_dll_symbols'
8f86407c Windows: Optionally generate DLL module definition files automatically
069aa93b bindexplib: Add support for "/bigobj" format objects
61bbbdcf bindexplib: Fix treatment of some symbols
de70c922 bindexplib: Teach DumpFile to return errors
8ea69dfe bindexplib: Build source as part of CMakeLib
2963cb2a bindexplib: Wrap long lines
4ff09893 bindexplib: Drop code that CMake does not need
7de8276c bindexplib: Add copyright/license notice block
65086ad7 bindexplib: Import original implementation from CERN
2015-07-08 09:19:07 -04:00
Bill Hoffman 8f86407cfd Windows: Optionally generate DLL module definition files automatically
Create target property WINDOWS_EXPORT_ALL_SYMBOLS to automatically
generate a module definition file from MS-compatible .obj files and give
it to the linker in order to export all symbols from the .dll part of a
SHARED library.
2015-07-06 11:11:02 -04:00
Stephen Kelly faec4e611d cmComputeTargetDepends: Change API to use cmGeneratorTarget. 2015-07-01 19:46:19 +02:00
Stephen Kelly e12afe766e cmState: Host some state from the cmGlobalGenerator. 2015-05-27 09:18:31 -04:00
Stephen Kelly c7b79aa16a cmGlobalGenerator: Require a cmake instance in ctor.
It is required anyway, so this makes it explicit.
2015-05-27 09:18:31 -04:00
Stephen Kelly e435f875ec VS: Move version information to global generator. 2015-05-19 11:02:33 -04:00
Stephen Kelly b17686d2bb cmGlobalGenerator: Move some flags from cmLocalGenerator.
These flags are global, and so they belong here instead of being
set on each local generator.
2015-05-14 20:36:28 +02:00
Stephen Kelly 32b8f03acc cmMakefile: Port users of GetStart* methods to new names. 2015-04-21 00:15:20 +02:00
Stephen Kelly 54d6a9187f cmMakefile: Rename GetCurrent{Output,Binary}Directory.
Match names used in CMake code.
2015-04-21 00:12:52 +02:00
Stephen Kelly 6162c9194b Use two-iterator std::set::insert where appropriate. 2015-01-11 17:00:55 +01:00
Brad King eeb60102e8 VS: Refactor CMAKE_FORCE_*64 platform definitions
Remove the general infrastructure for these additional platform
definitions and hard-code the only two special cases that used
it.  They are only for historical reasons so no new such cases
should be added.
2014-07-17 16:17:35 -04:00
Stephen Kelly e6971df6ab cmTarget: Make the source files depend on the config.
Disallow the use of config-specific source files with
the Visual Studio and Xcode generators. They don't have
any way to represent the condition currently.

Use the same common-config API in cmQtAutoGenerators. While
it accepts config-specific files, it doesn't have to support
multiple configurations yet.

Loop over the configs in cmTargetTraceDependencies
and cmGlobalGenerator::WriteSummary and consume all source
files.

Loop over the configs in cmComputeTargetDepends and compute the
object library dependencies for each config.
2014-04-02 23:14:02 +02:00
Brad King b16f26f5f9 Merge topic 'target-objects-refactor'
6c9dd0ec cmGlobalGenerator: Make ComputeTargetObjects non-virtual
c481fadc cmGeneratorTarget: Don't store ObjectSources for object libraries.
f6da0440 cmLocalGenerator: Add ComputeObjectFilenames interface.
9ad804ac cmGeneratorTarget: Constify cmSourceFile* in containers.
c725bb3c Constify some APIs in generators.
dcfcd23e cmGeneratorTarget: Make GetSourceDepends const.
04cf50ff cmOSXBundleGenerator: Make MacOSXContentGeneratorType arg const.
6132d979 cmGeneratorTarget: Constify the AddExplicitObjectName API.
bc512211 cmGeneratorTarget: Constify the AddObject API.
cd43433d cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.
d5b2e33b Makefiles: Compute local object files on demand.
2014-03-17 10:00:43 -04:00
Stephen Kelly 6c9dd0ec7b cmGlobalGenerator: Make ComputeTargetObjects non-virtual
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.
2014-03-15 09:30:24 +01:00
Clinton Stimpson ee8cef8725 Encoding: If configured, write Visual Studio project files as UTF-8. 2014-03-14 08:48:42 -06:00
Stephen Kelly f6da044080 cmLocalGenerator: Add ComputeObjectFilenames interface.
Implement it in the local generators and use it in the global
generators.
2014-03-13 15:28:02 +01:00
Stephen Kelly 9ad804ac7b cmGeneratorTarget: Constify cmSourceFile* in containers.
Some of them will be used with other APIs which require value_type
to be cmSourceFile const*.
2014-03-13 15:27:23 +01:00
Stephen Kelly cd43433de5 cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.
Make it public for future external calls.
2014-03-13 15:27:23 +01:00
Ben Boeckel 1a1b737c99 stringapi: Use strings for generator names 2014-03-08 13:05:38 -05:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
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.
2014-03-08 13:05:35 -05:00
Ben Boeckel fabf1fbabb stringapi: Use strings in target name 2014-03-08 13:05:31 -05:00
Clinton Stimpson 028a5285d8 OS X: Make sure RPATHs are unique to avoid possible corruption.
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.
2014-02-03 07:04:54 -07:00
Stephen Kelly 38de54cf6f cmGeneratorTarget: Add methods to access source file groups.
These methods and others will be able to get a config parameter
later to implement the INTERFACE_SOURCES feature.
2014-01-09 19:38:07 +01:00
Stephen Kelly ef25ba8d06 Constify handling of target dependencies. 2013-12-11 15:30:11 +01:00
Clinton Stimpson 0b9906c2fb Windows: Use wide-character system APIs
Make CMake compile with -DUNICODE.  Make it possible for the 8 bit
encoding to eventually be UTF-8 instead ANSI.
2013-12-09 10:29:43 -05:00
Brad King 558c74d0ab VS: Switch to internal CMAKE_MAKE_PROGRAM lookup by generators
Drop the "Modules/CMakeVS*FindMake.cmake" files.  Override the
cmGlobalGenerator::FindMakeProgram method for VS generators to use their
internal APIs to locate the build tool.  Set the CMAKE_MAKE_PROGRAM as a
normal variable for use by project code, but do not cache it.  This will
allow CMake and CTest to select the proper tool at build time.
2013-11-18 11:30:50 -05:00
Stephen Kelly fe732264e9 Add the INTERFACE_LIBRARY target type.
This target type only contains INTERFACE_* properties, so it can be
used as a structural node. The target-specific commands enforce
that they may only be used with the INTERFACE keyword when used
with INTERFACE_LIBRARY targets. The old-style target properties
matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for
this target type.

The name of the INTERFACE_LIBRARY must match a validity generator
expression. The validity is similar to that of an ALIAS target,
but with the additional restriction that it may not contain
double colons. Double colons will carry the meaning of IMPORTED
or ALIAS targets in CMake 2.8.13.

An ALIAS target may be created for an INTERFACE library.

At this point it can not be exported and does not appear in the
buildsystem and project files are not created for them. That may
be added as a feature in a later commit.

The generators need some changes to handle the INTERFACE_LIBRARY
targets returned by cmComputeLinkInterface::GetItems. The Ninja
generator does not use that API, so it doesn't require changes
related to that.
2013-10-07 19:56:31 -04:00
Patrick Gansterer b02f09d434 VS: Replace ArchitectureId with PlatformName
Since we do not need the information about the target architecture
we can use the PlatformName only to specify the this information.
This also removes setting of the MSVC_*_ARCHITECTURE_ID variable
which is not required, because this variable gets set by the
compiler detection code in CMAKE_DETERMINE_COMPILER_ID_CHECK().
2013-08-05 13:38:26 +02:00
Andreas Mohr bf019d765d Fix spelling and typos (non-binary) 2013-05-07 08:39:19 -04:00
Patrick Gansterer 102521b6b3 VS: Change variable type of ArchitectureId from const char* to string 2012-11-26 09:33:26 -05:00
Patrick Gansterer 332dc09d0d VS: Add static method to get the base of the registry 2012-11-26 09:33:25 -05:00
Patrick Gansterer 6f439b30cb VS: Remove AddPlatformDefinitions from platform-specific generators
Move the logic for handling platform specific defines from the
subclasses into the cmGlobalVisualStudioGenerator base class.
2012-11-19 12:54:57 -05:00
Stephen Kelly 5f6432f253 Resolve warnings about shadowing parameters and local variables. 2012-11-13 13:26:10 -05:00
Brad King 485a940e4c VS: Simplify MSVC version reporting
Teach Windows-cl.cmake to use CMAKE_(C|CXX)_COMPILER_VERSION to set the
"MSVC##" and MSVC_VERSION variables.  It no longer needs the IDE generator
to dictate the version or to detect the version by running the
command-line tool for NMake and Ninja generators.  Drop configuration of
CMakeCPlatform.cmake and CMakeCXXPlatform.cmake from Windows-cl.cmake.in
because all the results it saved are now cheap to compute every time.
2012-08-30 09:42:40 -04:00
Patrick Gansterer 2c7a451de0 VS: Cleanup AddPlatformDefinitions() of Visual Studio generators
Move adding of definitions into cmGlobalVisualStudioGenerator to
share code and avoid duplicate architecture string literals.
2012-08-22 15:08:40 -04:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Brad King 01e979acef VS: Add CMakeLists.txt re-run rules at start of generation
Since commit 328c0f65 (Simplify cmVisualStudio10TargetGenerator source
classification, 2012-03-19) the VS 10 generator uses the
cmGeneratorTarget source classification instead of directly getting the
list of source files from the target.  This accidentally dropped the
CMakeLists.txt files from generated projects because they are added too
late for cmGeneratorTarget.

All generator-specific source files must be added to targets prior to
cmGeneratorTarget construction.  Refactor addition of the CMakeLists.txt
files with CMake re-run custom commands to take place before normal
generation begins, and therefore early enough to be included in the
cmGeneratorTarget classification.
2012-03-28 14:07:51 -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 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 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 0bb22cfabe Avoid passing string literal to char* type 2010-12-28 09:57:35 -05:00
Brad King fd614e60b5 Use modern global dependency graph for VS < 8 deps
VS 7.1 and below have 2 behaviors that make the cmComputeTargetDepends
result difficult to use for solution-level dependencies.  Update the
method cmGlobalVisualStudioGenerator::ComputeTargetDepends to document
the behaviors and work around them.  Commit 1a0c166a (Store direct
dependencies in solutions for VS >= 8, 2010-08-20) isolated VS >= 8 from
this computation so those versions should be unaffected.

This change removes the last use of cmTarget::GetLinkLibraries for
purposes other than backward compatibility with legacy interfaces
(export_library_dependencies, VS 6 custom .dsp templates).  Now the
cmComputeTargetDepends results are used for all generators so global
target dependency computation is fully centralized.
2010-11-18 10:51:34 -05:00
Brad King 28edb70a9e Merge topic 'vs-project-groups'
e6ac0aa Add FOLDER target property, for IDEs (#3796)
2010-09-08 11:08:05 -04:00
David Cole e6ac0aacf6 Add FOLDER target property, for IDEs (#3796)
This work was started from a patch by Thomas Schiffer.
Thanks, Thomas!

See the newly added documentation of the FOLDER target
property for details.

Also added global properties, USE_FOLDERS and
PREDEFINED_TARGETS_FOLDER. See new docs here, too.

By default, the FOLDER target property is used to organize
targets into folders in IDEs that have support for such
organization.

This commit adds "solution folder" support to the Visual
Studio generators. Currently works with versions 7 through
10.

Also, use the new FOLDER property in the ExternalProject
test and in the CMake project itself.
2010-09-03 13:53:22 -04:00
Brad King 79a88c35f8 Refactor VS <= 7.1 utility-depends workaround
Commit 438a7e2f (Fix utility dependencies for static libraries in VS
generators, 2007-04-04) implemented utility-only dependencies between
linkable targets by introducing an intermediate non-linkable target.
We convert a dependency of the form

  foo -> bar

to the form

  foo -> bar_UTILITY -> bar

to prevent foo from including bar on its link line.  Previously we added
the extra "_UTILITY" targets explicitly among the project targets before
dependency analysis was performed.  Now we generate them separately at
the last moment so that cmGlobalGenerator need not be aware of them.
2010-08-24 18:47:56 -04:00
Brad King 325bdb2a92 Factor out duplicate VS target dependency code
Compute VS target dependencies in cmGlobalVisualStudioGenerator when the
main global dependency analysis is done.  Use these results in each of
the VS generators instead of duplicating the analysis.
2010-08-24 18:39:36 -04:00
Brad King 1b9e61f214 Add alternative _UTILITY targets to all solutions
In VS 6, 7, and 7.1 solutions we implement

  add_dependencies(myexe mylib) # depend without linking

by creating an intermediate mylib_UTILITY target with dependencies

  myexe -> mylib_UTILITY -> mylib

to avoid linking myexe to mylib.  Previously these extra targets were
only added to the solution files in an ancestor directory of that
defining mylib.  For example, in the project:

  # CMakeLists.txt
  project(TOP)
  add_subdirectory(A)
  add_subdirectory(b)

  # A/CMakeLists.txt
  add_library(mylib ...)

  # B/CMakeLists.txt
  project(B)
  add_executable(myexe ...)
  add_dependencies(myexe mylib)

the solution for TOP would have mylib_UTILITY but the solution for B
would not even though it pulls in mylib through the dependency.  This
commit fixes solutions generated in other directories so that any
solution that has mylib will get mylib_UTILITY also.

See issue #9568.
2009-10-01 10:27:02 -04:00
Brad King 7e5c571cce Move OrderedTargetDependSet into VS superclass
We move cmGlobalVisualStudio7Generator::OrderedTargetDependSet up to
cmGlobalVisualStudioGenerator so it can be re-used for other VS
versions.  See issue #9568.
2009-09-30 16:02:58 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
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.
2009-09-28 11:43:28 -04:00
Brad King 09e398fa9f Create VS generator GetRegistryBase method
This method returns the registry key

  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version>

A protected GetIDEVersion method retrieves the version-specific part of
the key name.
2009-09-16 11:44:08 -04:00