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.
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.
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.
In VS 8 and greater this commit implements
add_dependencies(myexe mylib) # depend without linking
by adding the
LinkLibraryDependencies="false"
option to project files. Previously the above code would cause myexe to
link to mylib in VS 8 and greater. This option prevents dependencies
specified only in the solution from being linked. We already specify
the real link library dependencies in the project files, and any project
depending on this to link would not have worked in Makefile generators.
We were already avoiding this problem in VS 7.1 and below by inserting
intermediate mylib_UTILITY targets. It was more important for those
versions because if a static library depended on another library the
librarian would copy the dependees into the depender! This is no longer
the case with VS 8 and above so we do not need that workaround.
See issue #9732.
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.
We move cmGlobalVisualStudio7Generator::OrderedTargetDependSet up to
cmGlobalVisualStudioGenerator so it can be re-used for other VS
versions. See issue #9568.
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.
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.