We revert commit "Create CMake Policy CMP0015 to fix set(CACHE)" because
the NEW behavior of the policy breaks a valid use case:
# CMakeLists.txt
option(BUILD_SHARED_LIBS "..." ON)
add_library(mylib ...)
set(BUILD_SHARED_LIBS OFF) # we want only mylib to be shared
add_subdirectory(ThirdParty)
# ThirdParty/CMakeLists.txt
option(BUILD_SHARED_LIBS "..." ON)
# uh, oh, with NEW behavior this dir uses shared libs!!!
We'll re-introduce the policy later with a different change in behavior
to resolve the motivating case, which was more subtle but less common.
See issue #9008.
The commit "Really fix color check for dependency scanning" disabled
color unless "make COLOR=ON" is specified. This restores the previous
default behavior when CMAKE_COLOR_MAKEFILE is ON while retaining the
previous commit's fix. See issue #9680.
The commit "Fix color check for dependency scanning" was meant to
disable color if CMAKE_COLOR_MAKEFILE was off. It did remove use of the
activation option '--color' but it failed to make the default false when
the option was missing. This commit corrects that. See issue #9680.
The commit "add support for borland run time flag for shared builds"
started using the value of CMAKE_SHARED_LIBRARY_CXX_FLAGS to link
executables because Borland requires some flags both at compile and link
time. This change ended up propagating all the way to the current
Makefile generators and the behavior applies on all platforms.
In general it is incorrect to use these flags to link executables. The
commit "Split Borland compiler information files" re-wrote Borland
support to work without this behavior, so we remove it in this commit.
Patch from Ben Hutchings. See issue #9659.
This commit re-writes Borland compiler build rules. We split the rules
into modern <os>-<id>-<lang> information modules but share a common
macro between languages to avoid duplication.
We also address a bug in the previous rules that would build some target
types against the static Borland runtime and others against the shared
Borland runtime in one build tree. Now we always use the shared runtime
as is the default in the rules for MS tools.
When <pkg>_DIR is set to an incorrect version we search again and store
the result in the variable, even if it is <pkg>_DIR-NOTFOUND.
There was a bug in the case when the new search does not find anything
and the old value came from a cache entry with UNINITALIZED type. The
command used to try to load a package configuration file from the last
place searched, and would leave the old wrong value in the entry. This
commit fixes the behavior to avoid trying to load a missing file and to
set the value to <pkg>_DIR-NOTFOUND as expected.
In cmMakefile::AddCacheDefinition we collapse paths specified in PATH or
FILEPATH cache entries originally specified on the command line with
UNINITALIZED type. This commit fixes the logic to avoid collapsing
<var>-NOTFOUND and other false values. The change allows other CMake
code to force a NOTFOUND value on an entry with UNINITALIZED type.
The commit "Support more special characters in file(STRINGS)" added code
using a 'char' literal as an array index. Some compilers warn about
this because char might be a signed type, leading to negative indices.
We replace the literal with an integer to avoid the warning.
The commits "Teach Fortran compiler identification about the Portland
Group compiler" and "Fix previous change to file(STRINGS) command"
taught file(STRINGS) to recognize the form-feed '\f' character as part
of string literals. The Portland Group Fortran compiler also puts 0x14
bytes at the end of string literals in some cases. We generalize the
previous solution and add the new character in this commit.
Scanning the dependencies for kdelibs/khtml/ (when all files are scanned) is
now down to 4.6 s from 6.3 s before this change (without the
headerLocationCache it takes about 14 s here).
It doesn't really make sense to include the complete include path as part
of the key for the map, since the include path will be the same for
all files in a project, so it doesn't add anything.
Alex
In cmGlobalGenerator::GetTargetSets we collect targets from all local
generators in a tree or subtree corresponding to a project() command.
Some targets, such as ALL_BUILD, are duplicated in each subdirectory
with a project() command. For such targets we should keep only the copy
for the top-most (root) local generator.
Previously this filtering was done in each VS IDE generator, but it is
easier to do it in one place when the targets are first encountered.
This also fixes bad ALL_BUILD dependencies generated for VS 7.0 because
the cmGlobalVisualStudio7Generator::WriteTargetDepends method was not
filtering out duplicates. Now we avoid duplicates from the start.
The commit "Target copy ctor should copy internal state" created a new
cmTargetInternals constructor but failed to initialize a POD member that
the original constructor initializes. This commit fixes it.
Ideally we should never copy cmTarget instances, but it is a pain to
remove current uses of it. The pimplized portion of cmTarget has mostly
members that cache results, but some are part of the object state.
These should be copied in the copy ctor instead of re-initialized.
The Encoding key is now deprecated by the FreeDesktop standard and all
strings are required to be encoded in UTF-8. This desktop entry
explicitly specified an Encoding of UTF-8, which is harmless but no
longer necessary. See
http://standards.freedesktop.org/desktop-entry-spec/1.0/apc.html
for details. Patch from Modestas Vainius. See issue #9659.
In cmTarget we compute the link implementation, link interface, and link
closure structures on-demand and cache the results. This commit teaches
cmTarget to invalidate results after a LINK_INTERFACE_* property changes
or a new link library is added. We also clear the results at the end of
the Configure step to ensure the Generate step uses up-to-date results.
In cmTarget::SetProperty and cmTarget::AppendProperty we check whether
changing the property invalidates cached information. The check was
duplicated in the two methods, so this commit moves the check into a
helper method called from both.
This method is called during ConfigureFinalPass on every target. It
gives each target a chance to do some final processing after it is known
that no more commands will affect it. Currently we just call the old
AnalyzeLibDependencies that used to be called directly.
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