Commit Graph

45 Commits

Author SHA1 Message Date
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
Brad King 885ab9ab37 VS: Drop reload macros for VS >= 10 (#11258,#14680)
We never implemented them for VS 11 (2012), 12 (2013), or 14 (2015).
For VS 10 (2010) the reload macro does not work correctly when run from
inside a build launched through the IDE because stopping the build kills
the CMake that is driving the reload.  Fortunately VS >= 10 know how to
reload the whole solution anyway.
2015-04-15 09:58:42 -04:00
Brad King f5c0efdbe4 cmGlobalGenerator: Create a non-virtual 'DoGenerate' method
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.
2014-07-22 15:05:36 -04: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 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
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
Ben Boeckel ce5114354c stringapi: Use strings for the languages 2014-03-08 13:05:30 -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 2cbf031190 cmGlobalGenerator: Make SelectMakeProgram const. 2014-01-12 20:18:11 +01:00
Stephen Kelly ef25ba8d06 Constify handling of target dependencies. 2013-12-11 15:30:11 +01: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
Brad King 3e04946f7b Require CMAKE_<LANG>_COMPILER to be found as a full path
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.
2013-10-28 08:36:14 -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
Patrick Gansterer 2118a2016f VS: Support setting correct subsystem and entry point for WinCE
WinCE has only one SubSystem. So the WIN32_EXECUTABLE property
must be handled via the EntryPointSymbol in the vcproj files.
2012-11-26 09:33:28 -05: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
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 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 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 973df7c0e9 VS10: Order .vcxproj dependencies deterministically (#10502)
This avoids needless modification of the project files during
regeneration.
2010-10-07 09:54:24 -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
David Cole 0b38bb4c53 Fix issue #2336 - honor the -C arg to ctest. Honor it for all stages of running -D dashboards from the command line and running ctest_configure, ctest_build and ctest_test commands in -S scripts. Also, allow a script to change it by setting the CTEST_CONFIGURATION_TYPE variable: allows for multiple configuration build/test cycles within one script. Add a new signature for the cmake command build_command that accepts CONFIGURATION as one argument. The original build_command signature is still there, but now marked as deprecated in the documentation. Of course... also add CTestConfig tests to verify that -C is honored for -D dashboards and -S scripts. 2009-12-04 12:09:01 -05:00
Brad King bc43b0f2a4 Do not link library dependencies in VS solutions
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.
2009-10-20 16:38:37 -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
Bill Hoffman 300514fd25 ENH: make sure GUIDs for filters are cached 2009-07-17 10:05:54 -04:00
Bill Hoffman 3d1c12b802 ENH: remove INCLUDE_EXTERNAL_MSPROJECT name hack, and use target properties instead, fix VXExternalInclude test for VS10 2009-07-14 14:16:46 -04:00
Bill Hoffman 10c91ded4f ENH: add support for Intel Fortran Visual studio IDE 2008-04-30 13:26:04 -04:00
David Cole ca2a16c0a2 ENH: Add code to support calling the VS reload macro from Visual Studio 7.1 and 9.0 in addition to 8.0 sp1... Make new macros file with VS 7.1 so that it can be read by 7.1 and later. VS 7.1 does not appear to run the macros while a build is in progress, but does not return any errors either, so for now, the reload macro is not called when using 7.1. If I can figure out how to get 7.1 to execute the macro, I will uncomment the code in cmGlobalVisualStudio71Generator::GetUserMacrosDirectory() to activate executing the macros in VS 7.1, too. 2008-02-15 11:49:58 -05:00
Brad King 3cf3bb664a ENH: Make static library targets depend on targets to which they "link" for the purpose of build ordering. This makes the build order consistent for static and shared library builds. It is also useful when custom command inputs of one library are generated as custom commands outputs of another. It may be useful in the future for Fortran module dependencies. Implemented for Makefiles, Xcode, and VS 8 and above. Added sample code to do it for VS 7.1 and below, but left it disabled with comments explaining why. Likely it will never be needed on VS 7.1 or below anyway. 2007-12-21 15:04:06 -05:00
Brad King 9f864879b4 ENH: Renamed cmGlobalVisualStudioGenerator::CallVisualStudioReloadMacro method to CallVisualStudioMacro and added arguments to select which macro to call and optionally pass the solution file name. Added option to call to new StopBuild macro. Updated logic for replacing the macro file in user directories when the distributed version is newer. 2007-11-19 13:44:51 -05:00
David Cole 867de7fc67 ENH: Add ability to call Visual Studio macros from CMake. Add a CMake Visual Studio macro to reload a solution file automatically if CMake makes changes to .sln files or .vcproj files. Add code to call the macro automatically for any running Visual Studio instances with the .sln file open at the end of the Visual Studio Generate call. Only call the macro if some .sln or .vcproj file changed during Generate. Also, add handling for REG_EXPAND_SZ type to SystemTools::ReadRegistryValue - returned string has environment variable references expanded. 2007-11-16 07:01:58 -05:00
Brad King 996f391593 BUG: The ALL_BUILD target should not have any command lines so that it is not always considered out of date. Moved the 'Build all projects' message into the description field instead of an echo in the command field. Moved common implementation of Generate for VS6 and VS7 into the superclass to avoid duplicate code for the ALL_BUILD target. This addresses bug#4556. 2007-04-10 13:09:03 -04:00
Brad King 438a7e2fce BUG: Fix utility dependencies for static libraries in VS generators. This addresses bug#4789. 2007-04-04 14:50:35 -04:00
Brad King 2c1204e361 ENH: Added cmGlobalVisualStudioGenerator as superclass to all VS global generators. 2007-04-04 11:22:14 -04:00