This commit re-words the warning message produced for CMP0012 to avoid
the word 'you' since often the person reading the message is not the
author of the code. We also add an example of the bad OLD behavior to
the policy documentation.
These policies were originally developed during the 2.7.x series and
intended for 2.6.5. There was never a 2.6.5 release, so we should refer
to 2.8.0 instead.
This commit creates target and directory properties to enable the Intel
interprocedural optimization support on Linux. Enabling it adds the
compiler option '-ipo' and uses 'xiar' to create archives.
See issue #9615.
This creates cmTarget::GetFeature and cmMakefile::GetFeature methods to
query "build feature" properties. These methods handle local-to-global
scope and per-configuration property lookup. Specific build features
will be defined later.
We create cmMakefileTargetGenerator::AddFeatureFlags to consolidate
addition of language flags. Currently it just adds the flags from
generic per-language flag variables (AddLanguageFlags).
There is confusion whether the file "currently being processed" inside a
function or macro is the file containing the definition or not. This
commit explicitly describes the behavior. See issue #9646.
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.
This commit cleans up the declaration, definition, and invocations of
the GetTargetSets method and related code. There is no change in
function except to make the method virtual.
This teaches the VS 6 IDE generator to use the transitive closure of
target dependencies. This re-uses much of the implementation already
done for the other VS>6 generators. See issue #8223 and issue #9568.
We move cmGlobalVisualStudio7Generator::OrderedTargetDependSet up to
cmGlobalVisualStudioGenerator so it can be re-used for other VS
versions. See issue #9568.
Some find-modules use get_filename_component() to expand registry
values. We need to look in both the 32-bit and 64-bit registry views
when expanding values. We prefer the one that the target application
would see. See issue #8792.
When building through NMake with VS 6, the module definition file must
be passed without spaces in the path. This is because 'cl -link' does
not escape the spaces when passing the value on to the linker.
Since Haiku does not have /usr (and therefore /usr/local), this commit
changes the default install prefix to the equivalent directory of
/boot/common.
See issue #9607.
We recognize .def source files and map them to the /DEF:<file> option in
the MSVC tools. Previously this worked only for shared libraries. This
commit cleans up the implementation and makes it work for executables
too. See issue #9613.
When constructing cmVisualStudioGeneratorOptions to parse options for
tools 'link' and 'lib' the tool type is now Linker, not Compiler. This
tells it not to recognize flags starting in '/D' as preprocessor macros,
such as the '/DEF:<file>' linker option. See issue #9613.
The commit "cmparseMSBuildXML should output StringProperty values too"
fixed the script that generated
Source/cmVS10CLFlagTable.h
Source/cmVS10LibFlagTable.h
Source/cmVS10LinkFlagTable.h
This commit updates the files with the new output.
Some older STL implementations invoke the comparison functor as a const
object, so the function call operator must be 'const' qualified. This
fixes the commit "Fix support for OLD behavior of policy CMP0002" to
compile on older STLs.
The commit "Cleanup make progress rule generation code" introduced a map
from target name to the progress.make file location. Policy CMP0002's
OLD behavior allows duplicate target names in different directories, so
only one ends up with a progress.make file. This commit fixes the map
to order by target name first and build directory second, restoring
support for duplicate target names.
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 converts the KWSys 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 KWSys copyright to
cover the full development time range.
This commit adds KWSys configuration option KWSYS_INSTALL_DOC_DIR to
specify the directory for installation of documentation. We use it to
put the KWSys Copyright.txt file at the location
${KWSYS_INSTALL_DOC_DIR}/${KWSYS_NAMESPACE}/Copyright.txt
in the project installation tree. This helps containing projects meet
the license requirement to distribute the copyright and license with
binary forms.
The commit "Generate proper Intel Fortran project version" replaced the
hard-coded 9.10 value with a runtime registry lookup of the real
version. Version 10.1 actually uses project file format 9.10, so this
commit switches it back for that version. See issue #9169.
Applications on Haiku are discouraged from storing their data in $HOME.
This teaches export(PACKAGE) and find_package() to use the BeAPI on
Haiku to store the package registry instead of using ~/.cmake/packages.
See issue #9603.
Set the working_dir entry in the codeblocks project file of executable
targets to the directory where the executable is created. Then when running
CB, executing the target (not building), will run it from that directory.
Alex
CMake policies CMP0014 and CMP0015 were implemented in the development
series version 2.7.x but will be first released in 2.8.0. Now that the
development version number is higher than that (2.9.x) we can update
their version of introduction to the actual release number.
In CMake Policy documentation we specify the default behavior for the
current version of CMake. This commit fixes that version by reporting
the full version number instead of just major and minor.
The commit "Fix KWSys SystemTools build on cygwin with -mwin32" tried to
restore the state of the _WIN32 definition that was broken by the commit
"Optimize KWSys SystemTools::FileExists on Windows". It did so for the
case of building with -mwin32 on cygwin, but since including <windows.h>
defines _WIN32, it failed for the case of not using -mwin32.
This commit restores the state of _WIN32 in all cases by undefining it
after including <windows.h> if it was not defined beforehand.
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.
Now only the dependencies for the file where the dependencies actually may
have changed are rescanned, before that this was done for all source files
even if only one source file had changed.
This reduces e.g. on my machine the time for scanning the dependencies
of kdelibs/khtml/ when only one file (khtml_global.cpp) has changed from
around 7.5 seconds to 1.2 seconds.
The tests succeed, it does what I expected it to do on kdelibs, and Brad
also reviewed the patch, so I think it should be ok.
Alex
Commit "Optimize KWSys SystemTools::FileExists on Windows" accidentally
added "#undef _WIN32" when including <windows.h> on cygwin, which breaks
builds using the -mwin32 flag. This commit removes that line and fixes
the real error it was intended to avoid.
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.
In cmLocalGenerator::ConvertToRelativePath we normally convert to
relative path only if the local and remote paths both lie inside the
source tree or both lie inside the build tree. This commit adds an
optional 'force' argument to allow conversion even when this rule is
violated.
If CMakeDirectoryInformation.cmake is newer than depend.internal the include
directories may have changed, so dependencies need to be scanned again.
Ok by Brad.
Alex
We optimize this method by using the GetFileAttributesExA native Windows
API to check for file existence when possible. For real Windows builds
we always use it. For Cygwin we use cygwin_conv_to_win32_path to get a
native Windows path if possible and otherwise fall back to 'access'.
Cygwin-to-Windows path conversion and cache by Wojciech Migda.
See issue #8826.
When reading the depend.internal file, check only once for every depender
whether it exists, instead of repeatedly in a loop for each dependee. Within
that function it can only change of the depender is removed. This is taken
care of.
This reduces the number of access() calls in kdelibs/khtml from 180000 to
90000 (i.e. 50%), and reduces the time for that (without the actual
scanning) from 0.3 s to 0.21 s on my system.
Alex
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.
Previously we checked for this flag by parsing the version number of GCC
out of 'gcc --version', but this is not reliable because the format can
vary greatly. Now we run 'gcc -v --help' and look for '-isysroot' in
the list of options.
We also now store the result on a per-language basis in the per-compiler
info file "CMake<LANG>Compiler.cmake". This is necessary to make it
accessible from try-compile projects so that they generate correctly.
Some vendor tools convert PDB file names given on the command line to
lower-case before creating the file. When CMake places a mixed-case PDB
file name into the build system, the file does not exist the first time
and it is written with mixed case. After the first build though the
native tool has created a lower-case version of the file. If CMake does
CollapseFullPath again, the file exists so the actual-case lookup gets
the lower-case name. This causes the build files to change so the
project rebuilds.
The solution is to avoid calling CollapseFullPath for files generated by
the build. In the case of PDB files we already construct them from
paths that have been collapsed, so we can just skip the call altogether.
See issue #9350.
In cmMakefile::AddSubDirectory we were checking for addition of the same
source directory multiple times. However, the check code was incorrect
because it compared pointers instetad of pointed-to strings. Since the
check was written, a better check was added right after it to enforce
unique binary directories (in which case duplicate sources are fine).
This commit simply removes the old-style check code.
Before this change all targets were displayed in the top level directory of
the project. Now the targets are displayed in the correct directory.
The targets "clean" and "all" are now created in every subdirectory.
Also now the targets for just compiling one file, preprocessing one file,
assembling one file are are created for Eclipse.
Additionally all targets get a prefix now in eclipse, so that they are
sorted in a way which makes sense (global targets first, then executable and
libraries, then object files, then preprocessed, then assembly). Also
this prefix gives the user a hint what the target is, i.e. whether it's a
library or an executable or something else.
Alex
This commit teaches configure_file how to handle directories for input
and output. It is an error if the input is a directory. If the output
is a directory we put the configured copy of the input file in it with
the same name. See issue #9537.
The configure_file() command now converts relative output paths to full
paths using the current binary directory. Input relative paths were
already converted using the current source directory, but this behavior
was not previously documented.
Now gcc is queried also for the builtin definitions, and they are then added
to the .cproject file. This should make the preprocessor highlighting in
eclipse work better (#9272)
Patch mostly from Miguel.
Alex
The Intel Visual Fortran compiler plugin for MS Visual Studio may be one
of several versions of the Intel compiler. This commit teaches CMake to
detect the plugin version and set the version number in .vfproj files.
See issue #9169.
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.
The commit "Improve dynamic variable scope implementation" optimized
function scopes using an efficient parent scope pointer. However, the
parent scope used to initialize a new directory might not exist later
(like add_subdirectory called inside a function of the parent scope).
This caused CMake to crash when following the dangling pointer to the
original parent scope.
We fix the problem in this commit by always computing the closure of the
parent scope at directory initialization time so that no parent scope
pointer is needed. See issue #9538.
The cmProcess::Buffer class derives from std::vector. We were using
local variable 'data' in the GetLine method but this name shadowed a
member of vector with GNU. This renames it to 'text'.
When we clear the buffer for an output pipe after returning the last
partial line (without a newline) we need to set the partial line range
to empty. Otherwise the buffer object is left in an inconsistent state.
This commit fixes cmCTestRunTest and cmProcess to more efficiently
handle child output. We now use the buffer for each child output pipe
to hold at most a partial line plus one new block of data at a time.
All complete lines are scanned in-place, and then only the partial line
at the end of the buffer is moved back to the beginning before appending
new data.
We also simplify the cmProcess interface by making GetNextOutputLine the
only method that needs to be called while the process is running. This
simplifies cmCTestRunTest so that CheckOutput can be called until it
returns false when the process is done.
The commit "Remove barely-used cmMakefile::AddCacheDefinition" removed
all but one use of the cmCacheManager method 'bool' overload. This
commit removes the other use and the entire method, thus reducing code
duplication.
The commit "Remove barely-used cmMakefile::AddCacheDefinition" broke
option() calls that pass a non-boolean default value. We restore the
old behavior by always coercing the value to 'ON' or 'OFF'.
The GNU compiler warns about possible operator precedence mistakes and
asks for explicit parentheses (-Wparentheses). We add the parentheses
to silence the warning. This also fixes one real logic error in the
find_package() implementation by correcting expression evaluation order.
The set(CACHE) and option() commands should always expose the cache
value. Previously we failed to expose the value when it was already set
if a local variable definition hid it. When set to NEW, this policy
tells the commands to always remove the local variable definition to
expose the cache value. See issue #9008.
The boolean overload of this method was used only to implement option().
We re-implement option() in terms of the main method and removes the
now-unused signature. This removes some duplicate code that had already
fallen behind on changes (it was not removing the local definition
instead of setting it).
Basically the code is now a copy of the one from the CodeBlocks generator,
maybe this could move into a common helper function somewhere:
-only insert GLOBAL targets from the toplevel directory
-don't insert the edit_cache target if it calls ccmake, since this doesn't
work in the output tab of Eclipse
-add the /fast targets
Alex
Visual Studio 10 uses MSBuild to drive the build. Custom commands
appear in MSBuild files inside CustomBuild elements, which appear inside
ItemGroup elements. The Outputs and AdditionalInputs elements of each
CustomBuild element are evaluated according to timestamps on disk.
MSBuild does not use inputs/outputs to order CustomBuild steps within a
single ItemGroup or across multiple ItemGroup elements. Instead we must
put only unrelated CustomBuild elements in a single ItemGroup and order
the item groups from top to bottom using a topological order of the
custom command dependency graph.
This fixes CustomCommand and ExternalProject test failures, so we remove
the expectation of these failures.
In each target we trace dependencies among custom commands to pull in
all source files and build rules necessary to complete the target. This
commit teaches cmTarget to save the inter-source dependencies found
during its analysis. Later this can be used by generators that need to
topologically order custom command rules.
Until now the VS 10 generator did no Windows command-line escaping and
just did XML escapes. This commit teaches the generator to use the same
command-line escape addition code used by other generators. The script
construction method cmLocalVisualStudioGenerator::ConstructScript need
not do XML escapes. Each VS generator version adds the XML escapes
necessary for that version.
It seems that
while(i=file.get(), file)
iterates one character too much on HP-UX, let's see whether
while(file.get(c))
works, at least this is given as example on http://h30097.www3.hp.com/cplus/ifstream_3c__std.htm
Alex
-add all global targets from CMAKE_BINARY_DIR to the menu, but not from the subdirs
-add all utility targets to the menu, except the Nightly/Experimental/Continuous-"sub"targets as e.
Alex
In cmTarget we trace the dependencies of source files in the target to
bring in all custom commands needed to generate them. We clean up the
implementation to use simpler logic and better method names. The new
approach is based on the observation that a source file is actually an
input (dependency) of the rule that it runs (compiler or custom) even in
the case that it is generated (another .rule file has the rule to
generate it).
This teaches cmTarget to use a set of cmSourceFile pointers to guarantee
unique insertion of source files in a target. The order of insertion is
still preserved in the SourceFiles vector.
When CMake is invoked by the VS IDE re-run rule we compute whether or
not CMake really needs to re-run based on some timestamp helper files.
Previously we assumed that if the main generate.stamp file exists then
VS has correctly detected that the file is out of date. However, this
assumption is too aggressive and re-runs CMake unnecessarily sometimes.
This commit removes the assumption and always checks timestamps itself.
The change breaks the explicit user re-run request (R-click -> Compile)
but only in cases when the build system is already up to date.
The VS generators use a ZERO_CHECK target on which all other targets
depend to check whether CMake needs to re-run. This commit simplifies
the addition of a dependency on the target to all other targets.
We also move addition of dependencies to the beginning of the Generate
step. This allows the dependency on ZERO_CHECK to be included in the
global inter-target dependency analysis.
KWSys tries not to force anything on source files that include its
headers, but Borland warning 8027 leaves us no choice when we want to
have inline function definitions. This commit disables the warning for
the RegularExpression header and any file that includes it.
Until now CMake accidentally accepted add_subdirectory() and subdirs()
calls referring to directories that do not contain a CMakeLists.txt
file. We introduce CMake Policy CMP0014 to make this case an error.
This method tells the cmMakefile to read the input CMakeLists.txt file.
We factor out the call into a ReadInputFile method so it can be extended
without polluting the Configure method.
Much of the code in this method was dedicated to computing ObjectMaxPath
after configuring the directory. We move this last step into its own
ComputeObjectMaxPath method for better organization.
The cmLocalGenerator::Configure method sets its cmLocalGenerator
instance as the global generator's current local generator during
configuration. This commit refactors management of the current local
generator to use an automatic variable. This will allow early returns
from the method.
CMake Makefile generators silently ignore missing CMakeLists.txt files
and just treat the source directory as if it had an empty input file.
This will be addressed with a new CMake Policy, but for now we make the
VS generator consistent with the Makefile generator behavior. The VS
generator will need to handle the OLD behavior of the policy anyway.
The cmGlobalGenerator::AddTargetDepends method traces the dependencies
of targets recursively to collect the complete set of targets needed for
a given project (for VS .sln files). This commit teaches the method to
avoid tracing its dependencies more than once. Otherwise the code does
an all-paths walk needlessly.
We define the export(PACKAGE) command mode to store the location of the
build tree in the user package registry. This will help find_package
locate the package in the build tree. It simplies user workflow for
manually building a series of dependent projects.
A common user workflow is to build a series of dependent projects in
order. Each project locates its dependencies with find_package. We
introduce a "user package registry" to help find_package locate packages
built in non-standard search locations.
The registry explicitly stores locations of build trees providing
instances of a given package. There is no defined order among the
locations specified. These locations should provide package
configuration files (<package>-config.cmake) and package version files
(<package>-config-version.cmake) so that find_package will recognize the
packages and test version numbers.
We create target property "LINK_INTERFACE_MULTIPLICITY" and a per-config
version "LINK_INTERFACE_MULTIPLICITY_<CONFIG>". It sets the number of
times a linker should scan through a mutually dependent group of static
libraries. The largest value of this property on any target in the
group is used. This will help projects link even for extreme cases of
cyclic inter-target dependencies.
The 'binary' openmode does not exist on all compilers. We define macro
<kwsys>_ios_binary, where <kwsys> is the KWSys namespace, to refer to
std::ios::binary if it exists and 0 otherwise. Sample usage:
kwsys_ios::ifstream fin(fn, kwsys_ios::ios::in | kwsys_ios_binary);
In cmComputeLinkInformation::Compute we add implicit link information
from languages other than the linker language to the end of the link
line. This factors out that code into separate methods to improve
readability and organization.
CTest runs 'svn status' to identify modified and conflicting files in
the working directory. This commit fixes the interpretation of the 'X'
status, which corresponds to svn eXternals. This status should be
ignored rather than treated as a local modification.
This introduces a new syntax called "generator expressions" to the test
COMMAND option of the add_test(NAME) command mode. These expressions
have a syntax like $<TARGET_FILE:mytarget> and are evaluated during
build system generation. This syntax allows per-configuration target
output files to be referenced in test commands and arguments.
We creates methods IsDLLPlatform() and HasImportLibrary(). The former
returns true on Windows. The latter returns whether the target has a
DLL import library. It is true on Windows for shared libraries and
executables with exports.
We teach cmTestGenerator::GenerateScriptConfigs to use the general
cmLocalGenerator::EscapeForCMake method to write escaped test property
values into test scripts. This eliminates the previous hand-coded
escaping implementation.