This cleans up the 'cmake --build' command-line interface:
- Rename --clean to --clean-first to better describe it.
- Replace --extra-options with a -- separator to simplify passing of
multiple native build tool options.
- Document the options in the main CMake man page description of the
--build option, and shares this with the usage message.
- Require --build to be the first argument when present.
- Move implementation into cmakemain where it belongs.
CTest encodes test and tool output in XML for dashboard submission.
This fixes the XML encoding implementation to not encode an invalid
character and instead put a human-readable tag in its place.
See issue #8647.
This teaches the helper commands 'cmake -E cmake_symlink_executable' and
'cmake -E cmake_symlink_library' to remove broken symlinks before
creating a symlink and report an error when the symlink cannot be
created. See issue #8654.
The <target>_EXPORTS macro defined for object files when built in a
shared library <target> should be put in the <DEFINES> make rule
replacement and not <FLAGS>. Also, it should honor the platform
variable CMAKE_<LANG>_DEFINE_FLAG. See issue #8107.
The second argument of add_subdirectory must name a unique binary
directory or the build files will clobber each other. This enforces
uniqueness with an error message.
This adds cmCTestVC::InitialCheckout and uses it in cmCTestUpdateHandler
to run the initial checkout command. The new implementation logs the
command in the update log consistently with the rest of the new update
implementation.
This fixes CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to be used for all
generators instead of just those that construct their own compiler
command lines directly. See issue #8598.
It does not make sense to call the reverse Convert signature (for remote
paths corresponding to CMake-managed directories) with NONE or FULL
since they have no path. Patch from Modestas Vainius. See issue #7779.
This adds a new VCS update implementation to the cmCTestVC hierarchy and
removes it from cmCTestUpdateHandler. The new implementation has the
following advantages:
- Factorized implementation instead of monolithic function
- Logs vcs tool output as it is parsed (less memory, inline messages)
- Uses one global svn log instead of one log per file
- Reports changes on cvs branches (instead of latest trunk change)
- Generates simpler Update.xml (only one Directory element per dir)
Shared components of the new implementation appear in cmCTestVC and may
be re-used by subclasses for other VCS tools in the future.
This creates variable CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to
specify implicit include directories on a per-language basis. This
replaces the previous platform-wide variable. It is necessary to
avoid explicit specification of -I/usr/include on some compilers
(such as HP aCC) because:
1.) It may break ordering among system include directories defined
internally by the compiler, thus getting wrong system headers.
2.) It tells the compiler to treat the system include directory
as a user include directory, enabling warnings in the headers.
See issue #8598.
This teaches cmCTestSVN::NoteNewRevision to save the repository URL
checked out in the work tree, the repository root, and the path below
the root to reach the full URL.
We used to suppress generation of -I/usr/include (and on OSX also
-I/usr/local/include). This behavior seems to cause more trouble than
it's worth, so I'm removing it until someone encounters the original
problem it fixed. See issue #8598.
The previous change to Source/cmDependsFortran.cxx while refactoring
implicit dependency scanning configuration rules completely broke
loading of the include file search path while scanning Fortran
dependencies. This adds the line that should have been added during the
previous change to load the include path correctly.
This adds the OPTIONAL option to the install(DIRECTORY) command. It
tells the installation rule that it is not an error if the source
directory does not exist. See issue #8394.
This class provides a RunProcess method to run a child process and send
its output to an abstract parsing interface. This also provides a
simple line parser and logger implementing the parsing interface.
In cmCTestUpdateHandler, this factors out version control tool detection
from the monolithic cmCTestUpdateHandler::ProcessHandler to separate
methods. This also places priority on detection of the tool managing
the source tree since using any other tool will cause errors.
This moves the initial checkout code from the monolithic
cmCTestUpdateHandler::ProcessHandler to a separate method
cmCTestUpdateHandler::InitialCheckout.
Previously we pre-quoted the command line tool path. This avoids it by
quoting the command everywhere it is used, thus preserving access to the
original, unquoted command.
This adds documentation of the APPEND option to the configure, build,
test, memcheck, and coverage commands. The docs leave specific
semantics for the dashboard server to define.
This corrects the terse documentation and adds detail to the full
documentation of some commands. It also normalizes the layout of the
documentation string endings to make adding lines easier.
This converts uses of 'char' as an array subscript to 'unsigned char' to
heed the warning from gcc. The subscript must be an unsigned type to
avoid indexing before the beginning of the array. This change avoids a
potential crash if input text contains a byte value beyond 0x7f.
This removes generation of some Update.xml content that is not used by
any Dart1, Dart2, or CDash servers:
- Revisions elements
- Directory attribute of File elements
- File elements within Author elements
The content was generated only because the original Dart1 Tcl client
generated it, but the content was never used.
The main svn update parsing loop in cmCTestUpdateHandler previously had
a logic error because the variable 'res' was not reset for each
iteration. For a locally modified file it would report the update info
for the previous non-modified file, or nothing if there was no previous
file. This fixes the logic by setting variable 'res' in both control
paths for each iteration. See issue #8168.
This renames the variable 'numModiefied' to 'numModified' to fix its
spelling. It also renames 'modifiedOrConflict' to 'notLocallyModified'
to describe its purpose (rather than the opposite of its purpose).
See issue #8168.
This teaches CTest to include source file labels in coverage dashboard
submissions. The labels for each source are the union of the LABELS
property from the source file and all the targets in which it is built.
Since CTest does not currently load configuration settings computed at
CMake Configure time while running dashboard scripts, the ctest_build
command must honor the CTEST_USE_LAUNCHERS option directly.
Currently CTest does not load configuration settings computed at CMake
Configure time when running a dashboard script. This adds a comment
describing refactoring that might help resolve the problem.
When we collect Build.xml fragments generated by 'ctest --launch', this
lexicographically orders fragments with the same time stamp on disk
instead of incorrectly dropping duplicates.
This defines a 'UseLaunchers' CTest configuration option. When enabled,
CTest skips log scraping from the Build step output. Instead it defines
the environment variable CTEST_LAUNCH_LOGS to a log directory during the
build. After the build it looks for error-*.xml and warning-*.xml files
containing fragments for inclusion in Build.xml and submission.
This is useful in conjuction with 'ctest --launch' and the RULE_LAUNCH_*
properties to get reliable, highly-granular build failure reports.
cmCTestLaunch first used an empty initializer list to zero-initialize a
buffer, but this is not supported on older compilers. Instead we avoid
the need for initialization altogether.
This creates an undocumented 'ctest --launch' mode. It launches a
specified command and optionally records a failure in an xml fragment.
We will optionally use this in CTest's Build stage to record per-rule
build failure information when using Makefile generators.
This defines global, directory, and target properties
RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK, and RULE_LAUNCH_CUSTOM. Their
values specify 'launcher' command lines which are prefixed to compile,
link, and custom build rules by Makefile generators.
This gives the cmTarget instance for which custom command rules are
being generated to cmLocalUnixMakefileGenerator3::AppendCustomCommands.
It will be useful in the future.
This creates a new LABELS property for targets and source files. We
write the labels of each target and its source files in target-specific
locations in the build tree for future use.
This creates method cmTarget::GetSupportDirectory to compute a
target-specific support directory in the build tree. It uses the
"CMakeFiles/<name>.dir" convention already used by the Makefile
generators. The method will be useful for any code that needs to
generate per-target information into the build tree for use by CMake
tools that do not run at generate time.
On Windows the GetLongPathName API function does not work on some
filesystems even if the file exists. In this case we should just use
the original long path name and not the GetShortPathName result.
See issue #8480.
This patch from Philip Lowman creates a REALPATH mode in the
get_filename_component command. It is like ABSOLUTE, but will also
resolve symlinks (which ABSOLUTE once did but was broken long ago).
See issue #8423.
This patch from Philip Lowman teaches SystemTools::GetRealPath to deal
with paths that do not exist by dealing with the case that realpath
returns NULL. See issue #8423.
When testing whether to re-run CMake, a byproduct may be a symlink. If
so, the existence of the link is important rather than the link's
target. See issue #8465.
App Bundle and Framework directories, symlinks, and Info.plist files we
create during generation are byproducts, not outputs. We should re-run
CMake only when they are missing, not when they are old.
See issue #8465.
A cmXMLSafe constructor named its parameter 'str' which shadowed the
name of the 'str' method. This renames the parameter to avoid the
conflict warning.
A previous change accidentally added the MacOS content directory and
Info.plist files created for MACOSX_BUNDLE executables to the list of
CMake input files. This causes CMake to re-generate the project too
often. These items should be added to the list of CMake output files.
The patch used to fix this bug used SystemTools::GetRealPath which works
only for existing files. It broke the case of using the command
get_filename_component for a non-existing file. Also, it changed
long-standing behavior in a possibly incompatible way even for existing
files. This reverts the original fix and instead updates the
documentation to be consistent with the behavior.
On some compilers 'char' is signed and is therefore always equal to or
less than 0x7f. In order to avoid the compiler warning we perform the
comparison with an unsigned char type.
This class provides easy syntax to efficiently insert blocks of data
into XML documents with proper escapes. It replaces the old
cmCTest::MakeXMLSafe and cmSystemTools::MakeXMLSafe methods which
allocated extra memory instead of directly streaming the data.
This moves the error/warning count summary printed by
cmCTestBuildHandler to after Build.xml is generated. Later we will
compute the counts during generation of the xml.
This divides cmCTestBuildHandler::GenerateDartBuildOutput into three
methods to generate the header, content, and footer components of
Build.xml files. It will allow the content generation to be replaced
later.
The old install_files, install_programs, and install_targets commands
used to permit installation to the top of the prefix by specifying
destination '/'. This was broken in 2.6.0 to 2.6.2 by changes to
enforce valid destinations that did not account for this case. This
change fixes the case by converting the install destination to '.' which
is the new-style way to specify the top of the installation prefix.
The recent change to avoid expanding rule variables in informational and
'cd' commands broke the logical order in generation of preprocess and
assembly rules. This corrects the order.
During bootstrap we do not bother with rule hashing. This updates the
dummy implementation to account for the recent change in rule hash
method signatures.
Previously the makefile generator would expand rule variables even on
its progress and echo commands for object compilation rules (but not for
link rules). This fixes the implementation to only expand rule
variables on user-specified rules.
This simplifies computation of custom command rule hashes to hash
content exactly chosen as the custom commands are generated.
Unfortunately this will change the hashes of existing build trees from
earlier CMake versions, but this is not a big deal. The change is
necessary so that in the future we can make optional adjustments to
custom command lines at generate time without changing the hashes every
time the option is changed.
This teaches cmMakefile::GetProperty and cmake::GetProperty methods to
return NULL when the property name is NULL, making them more robust and
consistent with the behavior of cmTarget::GetProperty.
This refactors generation of <Test> element headers and footers in
cmCTestTestHandler and re-uses it in cmCTestMemCheckHandler. The change
removes duplicate code and enables the new <Labels> element for MemCheck
results.
The link_directories command treats relative paths differently from most
CMake commands. This notes the difference in the documentation.
See issue #8377.
When running in script mode it is possible to run multiple separate
dashboard submissions in one cmCTest instance. The recent refactoring
of file submission lists into parts failed to clear the submission lists
when starting a new dashboard (ctest_start or ctest_update). Only the
unused old submission set was cleared. This fixes the refactored
version to remove the old submission set completely and also clear the
part-wise lists.
We need to initialize cmCTestSubmitHandler on construction to make sure
all parts get enabled by default. The recent fix to re-enable all parts
on initialization broke submit-only operations because the handler did
not initialize on construction. This also removes duplicate
initialization code.
Isolation of policy changes inside scripts is important for protecting
the including context. This teaches include() and find_package() to
imply a cmake_policy(PUSH) and cmake_policy(POP) around the scripts they
load, with a NO_POLICY_SCOPE option to disable the behavior. This also
creates CMake Policy CMP0011 to provide compatibility. See issue #8192.
This teaches functions and macros to use policies recorded at creation
time when they are invoked. It restores the policies as a weak policy
stack entry so that any policies set by a function escape to its caller
as before.
This re-organizes the discussion of the policy stack in documentation of
the cmake_policy() command. The new organization clearer and easier to
extend with new information.
A 'weak' poilcy stack entry responds normally to queries. However,
setting a policy in a weak entry will recursively set the policy in the
next entry too. This also gives the internal interface to create a weak
entry the option to provide an initial PolicyMap for it.
This makes cmMakefile::PushPolicy and cmMakefile::PopPolicy private so
that any outside place that uses them needs to use the PolicyPushPop
helper in an automatic variable. We grant an exception to
cmCMakePolicyCommand so it can implement cmake_policy(PUSH) and
cmake_policy(POP).
This creates cmMakefile::PolicyPushPop to push and pop policy scope
automatically. It also enforces balanced push/pop pairs inside the
scope it handles.
This defines PolicyMap as a public member of cmPolicies. Its previous
role as a policy stack entry is now called PolicyStackEntry and
represented as a class to which more information can be added later.
The previous change to order projects in the VS IDE did not account for
duplicate target names (such as ALL_BUILD and ZERO_CHECK) among the
input set. While we suppress generation of the duplicate project
entries, we need to use a multiset to store ordered duplicates.
The previous change to make ALL_BUILD come first among targets did not
account for comparing the target name against itself. This led to an
invalid ordering of the target set. This change fixes it.
This teaches the VS IDE generators to write ALL_BUILD into solution
files first so that it is always the default active project. Previously
it was first only if no target name sorted lexicographically earlier.
See issue #8172.
Our implementation of the feature to pull in dependent targets in VS
solution files for subprojects caused the order of project files in the
solution to be arbitrary (based on pointer value in the representation).
Target ordering in solution files is important to prevent unnecessary
changing of the files and because the VS IDE selects the first project
listed as the default active target. This change restores lexicographic
order by target name.
If a logical block terminates with mismatching arguments we previously
failed to remove the function blocker but replayed the commands anyway,
which led to cases in which we failed to report the mismatch (return
shortly after the ending command). The recent refactoring of function
blocker deletion changed this behavior to produce an error on the ending
line by not blocking the command. Furthermore, the function blocker
would stay in place and complain at the end of every equal-level block
of the same type.
This teaches CMake to treat the begin/end commands (if/endif, etc.) as
correct and just warns when the arguments mismatch. The change allows
cases in which CMake 2.6.2 silently ignored a mismatch to run as before
but with a warning.
This centralizes construction of the error message for an unclosed
logical block (if, foreach, etc.). We record the line at which each
block is opened so it can be reported in the error message.
This uses a stack of 'barriers' to efficiently divide function blockers
into groups corresponding to each input file. It simplifies detection
of missing block close commands and factors it out of ReadListFile.
Previously cmTarget::GetLocation and cmTarget::GetFullPath would return
for Mac AppBundles the top-level bundle directory but without the .app
extension. We worked around this at the call sites. This fixes the
methods and removes the work-arounds. See issue #8406.
When a function blocker decides to remove itself we previously removed
it at every return point from the C++ scope in which its removal is
needed. This teaches function blockers to transfer ownership of
themselves from cmMakefile to an automatic variable for deletion on
return. Since this removes blockers before they replay their commands,
we no longer need to avoid running blockers on their own commands.
Previously bad arguments to an if() or elseif() would cause some
subsequent statements in the corresponding block to execute. This
teaches CMake to stop processing commands with a fatal error. It also
provides context to bad elseif() error messages.
Recently we taught find_package to re-find a package configuration file
if it is given a wrong answer. This fixes the documentation to reflect
the change.
The documentation of cmake_policy PUSH and POP states that they must
always match. Previously we enforced this only for the top scope of
each CMakeLists.txt file. This enforces the requirement for all files.
This creates the variable CMAKE_VERSION containing the full version of
cmake in "major.minor.patch" format. It is particularly useful with the
component-wise version comparison provided by the if() command.
This uses an automatic variable to push and pop variable scope inside a
function call. Previously if the function failed its scope would not be
popped. This approach guarantees a balanced push/pop.
This splits the list of files for CTest to submit into those belonging
to each part. The set is recombined just before submission. Later this
will allow piecewise submissions.
This introduces the name "part" to denote a portion of the testing and
submission process performed by ctest. We generalize the boolean
indicating whether each part is enabled into a structure to which more
information can be added later. We provide bi-directional mapping
between part id and part names.
The previous approach to handling of arguments to ctest_* commands
worked only for keyword/value arguments with a single value. This
refactors the approach to allow some commands to define alternative
argument forms.
As it is today the generator creates linked resources to
LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH if they are not a
subdirectory of the binary dir, so that the IDE can detect the
Binaries (this was addressed previously as a result of a bug report).
Reduces code redundancy by encapsulating common behaviour for
LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH in AppendLinkedResource.
Addresses the two new variable names for these locations,
CMAKE_LIBRARY_OUTPUT_DIRECTORY and CMAKE_RUNTIME_OUTPUT_DIRECTORY respectively.
Finally, it is addressing a bug in the current code for relative paths
in these variables. If it is a relative path to the binary dir, the
IsSubdirectory call returns false and so it creates the linked
resource. The created linked resource produces an error in the Eclipse
IDE because the IDE expects it to be a full path. The patch now
addresses this by concatenating the binary dir if it is a relative
path.
The Generator="ctest..." attribute of Site elements in CTest-generated
XML files was missing a newline, causing the next attribute to appear on
the same line. This adds the newline.
The test is supposed to terminate quickly when its child crashes, but
that seems to take over 10s on busy systems. This extends the test's
timeout to 30s to help it pass when running on a busy system.
to by the Foo_DIR variable there is no FooConfig.cmake file, then instead of
abort and complain that the user should set or clear the Foo_DIR variables,
just search for the file and discard the old Foo_DIR contents
The tests succeed, ok by Brad.
Alex
When installing the main export file the install tree may be dirty. If
out-dated per-config files exist they may break the newly installed main
file which when it globs them. This teaches the installation script to
detect when it is about to replace the main export file with a different
one and cleans out any existing per-config files.
New method cmExportInstallFileGenerator::GetConfigImportFileGlob
computes the globbing expression that an installed export file uses to
load its per-configuration support files.
This moves management of the LC_MESSAGES environment variable into an
automatic variable. Previously if an error occurred the original
environment value was not restored. This makes the fix to issue #5936
more robust.
Previously we stored a vector of tests to preserve their order.
Property set/get operations would do a linear search for matching tests.
This uses a map to efficiently look up tests while keeping the original
order with a vector for test file generation.
When CTest detects that a test is running its own executable it
optimizes the test by using an internal instance of cmCTest instead of
creating a new process. However, the internal instance was using cout
and cerr directly. This redirects the output to a string stream to
avoid direct display of the internal test's output.
When CMake 2.4 generates the build tree for CMake itself it asks the
built CMake to install itself using the rules that 2.4 generated. Since
the install rules use undocumented commands that are not compatible from
2.4 to 2.6 we need a special case to avoid failure. This sets a special
indicator variable in the install rules that enables a compatibility
hack to support the old install rule format.
The internal file(INSTALL) command argument parsing used several
booleans with at most one set to true at a time to track argument
parsing state. This refactors it to use one enumeration.
The get_target_property command contained some outdated documentation of
the LOCATION and TYPE properties. This removes it since they are now
documented in the properties list section of the documentation.
Previously we left the LOCATION property undefined for imported targets
since it should no longer be used for non-imported targets. However, in
the case we do not know the name of an available imported configuration,
it is more readable to get the LOCATION property than LOCATION_<CONFIG>
for a bogus configuration <CONFIG>. This enables LOCATION for imported
targets and returns an unspecified available imported configuration.
The FATAL_ERROR to cmake_minimum_required is useful for projects that
require 2.6 to convince CMake 2.4 to error out. This clarifies its
usefulness in the documentation.
When cmake_minimum_required is called with an unknown argument it should
not complain about it if the version specified is in the future. This
allows the proper error to be shown about the current CMake being too
old.
When computing runtime search path ordering a constraint exists when a
file that may be found by the runtime search exists in a directory other
than that containing the desired file. We test whether a potential
conflict is really the same due to a symlink. Recently the change to
cmFindLibraryCommand to load directory content created a case in which
the same-file check would be incorrectly skipped. This avoids skipping
the check.
On Windows the KWSys System package generates escapes for command-line
arguments. This fix enables quoting of the empty string as an argument.
This also adds a test to pass an empty argument to a custom command.
When ctest --build-and-test runs the --test-command its output did not
quote the arguments of the command being tested making it difficult to
read. This adds the quotes. This also changes the wording of the
failure case to not sound like CTest could not run the executable when
in fact it ran and returned failure.
When CTest encounters a test whose executable is the ctest executable
iteslf, it just invokes code inside itself to avoid starting a new
process. This fixes a null-pointer dereference in the logging code of
that case.
The command argument lexer was recently regenerated which erased some
fixes that had been applied directly to the output. This restores the
fixes and adds reminder notes in the generation instructions.
The command argument parser code is generated by bison. This change
restores some fixes previously applied to the generated output that were
destroyed by regenerating the parser source. This time the fixes have
been put in the input file so regenerating the parser will not destroy
them again.
We now search in
<prefix>/<name>*/
<prefix>/<name>*/(cmake|CMake)
when looking for package configuration files. This is useful on Windows
since the Program Files folder is in CMAKE_SYSTEM_PREFIX_PATH. These
paths are the Windows equivalent to the Apple convention application and
framework paths we already search. See issue #8264.
The $ENV{VAR} syntax permits access to environment variables. This
teaches CMake to recognize most characters in the VAR name since some
environments may have variables with non-C-identifier characters.
For bug #7191.
Improvements to the dialog that sets up the first configure.
Fixing the large size of it by breaking it up into a wizard.
Also incorporated suggestions from bug report.
When the find_package command loads a <name>-version.cmake file to test
the package version it must prevent the version file from affecting
policy settings. Therefore the policy settings must be pushed and
popped.
Generated cmake_install.cmake script code used MATCHES to compare
component names. This does not support characters considered special by
regular expression syntax in component names. This change uses STREQUAL
instead. See issue #8256.
When an object file directory is too deep to place an object file
without exceeding CMAKE_OBJECT_PATH_MAX, this issues a warning.
Previously we silently ignored the problem. See issue #7860.
When computing the maximum length full path to the build directory under
which object files will be placed, pass the actual path instead of just
its length. This will be useful for error message generation.
The CMAKE_<CONFIG>_POSTFIX variable and <CONFIG>_POSTFIX property were
not documented. This updates the CMAKE_DEBUG_POSTFIX and DEBUG_POSTFIX
documentation to refer to the more general variable/property. It also
clarifies that the variable is used as the property default only for
non-executable targets. See issue #7868.
This teaches find_package to search
<prefix>/(share|lib)/cmake/<name>*/
for package configuration files. Packages that do not already have
files in a <prefix>/lib/<name>* directory can use this location to avoid
cluttering the lib directory.
When the find_package command loads a module it sets several
<pkg>_FIND_XXX variables to communicate information about the command
invocation to the module. This restores the original state of the
variables when the command returns. This behavior is useful when a
find-module recursively calls find_package with NO_MODULE so that the
inner call does not change the values in the find-module.
When we install a target on Mac, we generate a call to install_name_tool to fix
install_name entries in the target for shared libraries it links. This change
makes the step ignore entries for imported targets since their install_name
will not change and cmTarget cannot produce a mapping for them. This fixes the
error
GetLibraryNamesInternal called on imported target: kdelibs
seen by kde folks.
executing a ctest script so the search paths are fully set up and variables
like CMAKE_SYSTEM are available. This is useful e.g. for new-style ctest
scripting.
(these files are also loaded on startup by cpack, so now they behave
similar).
Hmmm, maybe they should be also loaded by cmake -P ?
Alex
The output of "cvs update" contains a line such as one of
cvs update: `foo.txt' is no longer in the repository
cvs update: foo.txt is no longer in the repository
cvs update: warning: foo.txt is not (any longer) pertinent
when file "foo.txt" has been removed in the version to which the update
occurs. Previously only the first case would be recognized. This fixes
the regular expression to match all these cases.
KWSys component dependencies must be enforced before any tests for
enabled components are done. This moves the dependency enforcement code
to be as early as possible.
We use response files to list object files for the MSVC linker. The
linker complains if any response file is greater than 128K, so we split
the object file lists into multiple response files.
Previously generation of object file lists for linker and cleaning
command lines was duplicated for library and executable target
generators. This combines the implementations.
This clarifies documentation of the find_* commands' PATH_SUFFIXES
option. The option adds paths with the suffixes but does not remove the
paths without the suffixes.
In cmFindBase we were searching all path suffixes appended to all paths
before considering the paths without any suffixes. Instead we should
consider each path with and without suffixes before moving to the next
path. See issue #7783.
This adds a missing default constructor to cmListFileContext that makes
sure the line number is initialized to zero. A zero line number will
indicate a generated context.
Applying patch provided in issue #7797.
Fixes to man-pages:
- Character '-' must be espaced as '\-'
- Surround preformatted text with '.nf' and '.fi' to adjust filling
- Give every page a NAME section for indexing by mandb
- Pass the man page filename without extension to .TH in its header
Also added a title to the HTML header.
These changes refactor cmLocalGenerator methods Convert and
ConvertToOutputForExisting to support references inside the build tree
using relative paths. After this commit, all tests pass with Makefile
generators when relative paths are enabled by default. See issue #7779.
The cmMakefile::DefineFlagsOrig ivar was created to help preserve the
old DEFINITIONS property behavior now that definitions are moved from
DefineFlags to the COMPILE_DEFINITIONS directory property. This fixes
propagation of the original value into subdirectories.
This adds a SOURCES option to ADD_CUSTOM_TARGET, enabling users to
specify extra sources for inclusion in the target. Such sources may not
build, but will show up in the IDE project files for convenient editing.
See issue #5848.
After creating a utility target with AddUtilityCommand, return a pointer
to the cmTarget instance so the caller may further modify the target as
needed.
Recently we taught find_package that the NO_MODULE option is implied
when it is recursively invoked in a find-module. This behavior may be
confusing because two identical calls may enter different modes
depending on context. It also disallows the possibility that one
find-module defers to another find-module by changing CMAKE_MODULE_PATH
and recursively invoking find_package. This change reverts the feature.
We generate convenience rules to build object files, preprocessed
outputs, and assembly outputs of source files individually with make
rules. This removes a redundant working directory change when more than
one target builds the same source file.
Package version test files may now declare that they are unsuitable for
use with the project testing them. This is important when the version
being tested does not provide a compatible ABI with the project target
environment.
These changes teach find_package to behave nicely when invoked
recursively inside a find-module for the same package. The module will
never be recursively loaded again. Version arguments are automatically
forwarded.
In single-configuration generators a target installation rule should
apply to all configurations for which the INSTALL command was specified.
The configuration in which the target is built does not matter.
In multi-configuration generators each installation rule must be
associated with a particular build configuration to install the proper
file. The set of configurations for which rules are generated is the
intersection of the build configurations and those for which the INSTALL
command was specified.
In SharedForward, the call to execvp warned on MinGW because the
signature declared in process.h has an extra const. We use an explicit
cast to convert the pointer type.
To detect when the launcher is running from the build tree we now test
if the directory containing it is the same as the build-tree directory
using an inode test instead of string comparison. This makes it more
robust on case-insensitive filesystems and other quirky situations.
If the arguments to a command fail to parse correctly due to a syntax
error, the command should not be invoked. This avoids problems created
by processing of commands with bad arguments. Even though the build
system will not be generated, the command may affect files on disk that
persist across CMake runs.
We now properly report the source location of command arguments inside
macros instead of using the macro invocation site. No information is
lost because full call-stack information is already reported.
Previously error messages produced by parsing of command argument
variable references, such as bad $KEY{VAR} syntax or a bad escape
sequence, did not provide good context information. Errors parsing
arguments inside macro invocations gave no context at all. Furthermore,
some errors such as a missing close curly "${VAR" would be reported but
build files would still be generated.
These changes teach CMake to report errors with good context information
for all command argument parsing problems. Policy CMP0010 is introduced
so that existing projects that built despite such errors will continue
to work.
Automatic generation of 64-bit library search paths must preserve
trailing slashes. This fixes a failure case exposed by the recent
rewrite of find_library, which assumes trailing slashes occur on all
search paths.
OpenBSD shared libraries use a ".so.<major>.<minor>" extension and do
not have a symlink with just a ".so" extension. Its "ld" is capable of
finding the library with the best version. This change adds support for
finding such libraries. See issue #3470.
Previously we searched for library files by enumerating every possible
combination of prefix and suffix. Now we load (and cache) directory
content from disk and search for matching file names. This should
reduce disk access. It will also allow more advanced matching rules in
the future. See issue #3470.
Previously the cmGlobalGenerator::GetDirectoryContent method would work
safely only during build system generation. These changes make it safe
to use during each configure step by flushing it at the beginning.
When looking for NOTFOUND libraries, use the direct dependencies of a
target instead of all dependencies. At least one target will trigger
the NOTFOUND error anyway because at least one must directly link it.
This removes another use of the old-style link line computation.
In some cases it may be useful to compute a "link" line for a static
library even though it will not be put in the generated build system.
This removes the assertion which previously diallowed the case.
In cmComputeLinkInformation items in the final link line returned by
GetItems now contain a pointer to their corresponding cmTarget if they
were produced by a target. This makes available the set of all targets
linked.
In cmGlobalGenerator we use cmComputeTargetDepends to construct a safe,
non-circular set of inter-target dependencies. This change enables use
of the results by the Xcode generator. It also removes a lot of old
code and another use of the old-style linking logic. See issue #7652.
Provide VERSION_LESS, VERSION_EQUAL, and VERSION_GREATER operators in
the if() command. This simplifies component-wise comparison of version
numbers in the form "major[.minor[.patch[.tweak]]]".
Make the number of version components specified explicitly available.
Set variables for unspecified version components to "0" instead of
leaving them unset. This simplifies version number handling for find-
and config-modules. Also support a fourth "tweak" version component
since some packages use them.
Use the new-style error reporting mechanism to provide more context
information for a find_package call with a bad package name. When the
package is not required, issue a warning instead of an error.
The set_property command unsets a property if it is given no value. In
the case of GLOBAL properties, the cmake::SetProperty method would
replace a NULL value with "NOTFOUND". Instead it should be left as NULL
so that the property is unset as expected. Once it is unset the
get_cmake_property command will still report NOTFOUND while the
get_property command will return the empty string as documented.
When the -C or --build-config option is used to specify the
configuration to be tested by CTest, do not override it with the
configuration in which CTest is built.
A Mac OS X Framework should provide a Resources/Info.plist file
containing meta-data about the framework. This change generates a
default Info.plist for frameworks and provides an interface for users to
customize it.
This change cleans up the implementation of cmXCodeObject to avoid
un-escaping and re-escaping string values. There is no need to store
the string in escaped form. It can be escaped once when it is printed
out to the generated project file.
The recent fix to avoid including flags in dependency inferral also
dropped them from chaining of dependencies through targets. This fix
restores chaining of flags through known dependency lists while still
leaving them out of inferred dependency lists.
This change introduces a new algorithm for link line construction. The
order it computes always begins with the exact link line specified by
the user. Dependencies of items specified by the user are tracked, and
those that are not already satisified by the line are appended to it at
the end with minimal repeats. This restores the behavior of CMake 2.4
and below while still fixing some of its bugs. See issue #7546.
In cmComputeLinkDepends link items that look like flags (starting in
'-') should not be included in dependency inferral. They are not
libraries and therefore have no dependencies. They should just be
passed through to the final link line unchanged. See issue #7546.
This introduces the unset() command to make it easy to unset CMake
variables, environment variables, and CMake cache variables. Previously
it was not even possible to unset ENV or CACHE variables (as in
completely remove them). Changes based on patch from Philip Lowman.
See issue #7507.
Some native build tools, particularly those for cross compiling, may
have a limit on the length of the full path to an object file name that
is lower than the platform otherwise supports. This change allows the
limit to be set by the project toolchain file through the variable
CMAKE_OBJECT_PATH_MAX.
It is useful to be able to test if a target has been created. Often
targets are created only inside conditions. Rather than storing the
result of the condition manually for testing by other parts of the
project, it is much easier for the other parts to just test for the
target's existence. This will also be useful when find-modules start
reporting results with IMPORTED targets and projects want to test if a
certain target is available.
According to "man select" on Linux it is possible that select() lies
about data being ready on a pipe in some subtle cases. We deal with
this by switching to non-blocking i/o and checking for EAGAIN. See
issue #7180.
The LINK_INTERFACE_LIBRARIES target property may not contain the
"debug", "optimized", or "general" keywords. These keywords are
supported only by the target_link_libraries (and link_libraries) command
and are not a generic library list feature in CMake. When a user
attempts to add one of these keywords to the property value, we now
produce an error message that refers users to alternative means.
The LINK_INTERFACE_LIBRARIES property does not apply for STATIC
libraries. The IMPORTED_LINK_INTERFACE_LIBRARIES property does apply
for STATIC libraries. State both explicitly in the documentation.
Also, clarify that the per-configuration version of these properties
completely overrids the generic version.
The compatibility check to allow linking to modules should test for
CMake 2.2, not the unreleased 2.3. See issue #7500. Furthermore, the
message should be more clear about fixing the code instead of setting
CMAKE_BACKWARDS_COMPATIBILITY unless one is just trying to build an
existing project.
In the future some policies may be set to REQUIRED_IF_USED or
REQUIRED_ALWAYS. This change clarifies the error messages users receive
when violating the requirements.
When creating an IMPORTED target for a library that has been found on
disk, it may not be known whether the library is STATIC or SHARED.
However, the library may still be linked using the file found from disk.
Use of an IMPORTED target is still important to allow per-configuration
files to be specified for the library.
This change creates an UNKNOWN type for IMPORTED library targets. The
IMPORTED_LOCATION property (and its per-config equivalents) specifies
the location of the library. CMake makes no assumptions about the
library that cannot be inferred from the file on disk. This will help
projects and find-modules import targets found on disk or specified by
the user.
In switch statements that deal with only a few target types, use a
'default' case for the remaining target types instead of listing them
explicitly. This will make it easier to add more types in the future.
Rename the recently added INTERFACE mode of the target_link_libraries()
command to LINK_INTERFACE_LIBRARIES. This makes it much more distinct
from a normal call to the command, and clearly states its connection to
the property of the same name. Also require the option to appear
immediately after the target name to make it a mode rather than an
option.
It is likely that projects or CMake modules in the future will need to
check the value of a policy setting. For example, if we add a policy
that affects the results of FindXYZ.cmake modules, the module code will
need to be able to check the policy.
During installation the RPATH and RUNPATH entries of ELF binaries are
edited to match the user specification. Usually either one entry is
present or both entries refer to the same string literal. In the case
that they are both present and refer to separate string literals we need
to update both. I have never seen this case in practice, but we should
do this just in case.
Removal of the RPATH and RUNPATH from ELF binaries must work when both
entries are present. Both entries should be removed. Previously only
one would be removed and the other would be blanked because it pointed
at the same string which was zeroed. This fixes gentoo bug number
224901.
Create an INTERFACE option to the target_link_libraries command to help
set the LINK_INTERFACE_LIBRARIES and LINK_INTERFACE_LIBRARIES_DEBUG
properties. This will help users specify link interfaces using
variables from Find*.cmake modules that include the 'debug' and
'optimized' keywords.
The "debug", "optimized", and "general" link library type specifier
arguments to the target_link_library commands are sometimes repeated in
user code due to variable expansion and other complications. Instead of
silently accepting the duplicates and trying to link to a bogus library
like "optimized.lib", warn and ignore the earlier specifiers.
The add_subdirectory() command's EXCLUDE_FROM_ALL option does not
override inter-target dependencies. This change clarifies the
documentation accordingly.
When an executable target within the project is named in
target_link_libraries for another target, but the executable does not
have the ENABLE_EXPORTS property set, then the executable cannot really
be linked. This is probably a case where the user intends to link to a
third-party library that happens to have the same name as an executable
target in the project (or else will get an error at build time). We
need to avoid making the other target depend on the executable target
incorrectly, since the executable may actually want to link to that
target and this is not a circular depenency.
After reporting an error about circular target dependencies do not try
to continue generation because the dependency computation object is not
in a useful state.
Custom command dependencies that are not full paths or targets may also
match source files. When one does, the full information about the
source file's location and name may be used. This fixes the case when a
custom commands depends by relative path on a source file generated by
another custom command specifying its output by relative path.
A name with an ambiguous extension may only match an unambiguous name
that is extended by one of the fixed set of extensions tried when
finding the source file on disk. This rule makes matching of source
files with ambiguous extensions much less aggressive but still
sufficient.
When generating RPATH entries on the link line using a repeated linker
flag (-R ... -R ... style) do not convert individual entries to a full
path. We need to preserve what the user requested.
When generating escape sequences for the native build tool do not put in
Makefile escapes for paths generated into link scripts. This fixes
putting "$ORIGIN" into the RPATH, and probably some other subtle
problems.
Creation of archive libraries with the unix 'ar' tool should be done
incrementally when the number of object files is large. This avoids
problems with the command line getting too many arguments.
When attempting to load the RPATH out of a non-ELF file cmELF would
crash because the check for a valid file was done with in correct
operator precedence. See bug#7392.
For historical reasons we still support naming of source files without
their extension. Sources without known extensions are located on disk
by iterating through a fixed set of possible extensions. We now want
users to always specify the extension, so the fixed set will not be
expanded and is preserved for compatibility with older projects.
This change adds recognition of extensions of all enabled languages to
avoid checking the disk for files whose extensions are unambiguous but
not in the original fixed set.
In CMake 2.4 the generated link line for a target always preserved the
originally specified libraries in their original order. Dependencies
were satisfied by inserting extra libraries into the line, though it had
some bugs. In CMake 2.6.0 we preserved only the items on the link line
that are not known to be shared libraries. This reduced excess
libraries on the link line. However, since we link to system libraries
(such as /usr/lib/libm.so) by asking the linker to search (-lm), some
linkers secretly replace the library with a static library in another
implicit search directory (developers can override this by using an
imported target to force linking by full path). When this happens the
order still matters.
To avoid this and other potential subtle issues this commit restores
preservation of all non-target items and static library targets. This
will create cases of unnecessary, duplicate shared libraries on the link
line if the user specifies them, but at least it will work. In the
future we can attempt a more advanced analysis to safely remove
duplicate shared libraries from the link line.
We preserve the order and multiplicity of libraries directly linked by a
target as specified by the user. Items known to be shared libraries may
be safely skipped because order preservation is only needed for static
libraries. However, CMake 2.4 did not skip shared libs, so we do the
same when in 2.4 compatibility mode.
We never explicitly specify system library directories in linker or
runtime search paths. Furthermore, libraries in these directories are
always linked by asking the linker to search for them. We need to
generate a warning when explicitly specified search directories contain
files that may hide the system libraries during the search.
This change introduces policy CMP0008 to decide how to treat full path
libraries that do not appear to be valid library file names. Such
libraries worked by accident in the VS IDE and Xcode generators with
CMake 2.4 and below. We support them in CMake 2.6 by introducing this
policy. See policy documentation added by this change for details.
Sometimes we ask the linker to search for a library for which the path
is known but for some reason cannot be specified by full path. In these
cases do not include the library in CMP0003 warnings because we know the
extra paths are not needed for it.
- This case worked accidentally in CMake 2.4, though not in Makefiles.
- Some projects build only with the VS IDE on windows and have this
mistake.
- Support them when 2.4 compatibility is enabled by adding the extension.
CMAKE[_SYSTEM]_(LIBRARY|PROGRAM|INCLUDE|PREFIX)_PATH variables
-moved CMAKE_CROSSCOMPILING from "Variables that modify behaviour" to
"variables that Provide Information", since it should be used only for
testing whether we are currently in cross compiling mode, not for switching
between the modes.
Alex
- The source-file signature of try_compile looks up the language
of the source file using the extension-to-language map so that
it knows what language to enable in the generated project.
- This map needs to be filled before loading a file specified by
CMAKE_USER_MAKE_RULES_OVERRIDE
CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG>
so that the user file may call the try_compile() source-file
signature.
- It must still be re-filled after loading CMake<LANG>Information.cmake
in case the compiler- or platform-specific files added anything.
- See bug #7340.
Details:
==========
- New cpack_add_component, cpack_add_component_group, and
cpack_add_install_type "commands" defined as macros in the CPack
module.
- Documentation for all of the variables and commands in the CPack module.
- Added get_cmake_property(... COMPONENTS) to CMake to ask for the
names of all components. Used in the CPack module to automatically
build component-based installers. (Set CPACK_MONOLITHIC_INSTALL to
turn off component-based installation).
- A group can declare its PARENT_GROUP, to build an arbitrary
hierarchy of groups.
- New CPack command cpack_configure_downloads, which creates an
installer that downloads only the selected components on-the-fly.
Those components marked DOWNLOADED will be separate packages
downloaded on-the-fly (or, all packages can be marked as such with the
ALL option to cpack_configure_downloads). Individual components are
compressed with ZIP at installer-creation time and
downloaded/uncompressed by the installer as needed. This feature is
only available on Windows with NSIS at the moment.
- NSIS installers can install themselves and enable the "Change"
button in Add/Remove programs, allowing users to go back and install
or remove components. This can be disabled through
cpack_configure_downloads, because it's only really useful is most of
the application's functionality is in downloaded components.
- Bug fix: automatically install everything whose COMPONENT was not
specified (it's a hidden, required group)
- Bug fix: fixed removal of components when re-running the NSIS
installer and unchecking components
- Bug fix: NSIS installers now only install/remove the minimal
number of files when re-run to update the installation (or by clicking
"Change" in Add/Remove programs)
- The Info.plist file in app bundles should not be built.
- User-specified files such as foo.txt should not be built.
- Only files with a recognized language should be built,
just as in the Makefiles generators.
- See bug #7277.
- We used to always put LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH
in the cache if the project did not.
- In CMake 2.6 these variables should no longer be used.
- Now add them only if CMAKE_BACKWARDS_COMPATIBILITY is also cached.
- This happens only when CMP0001 is set to OLD or WARN or if
the user or project sets it. In any case compatibility is needed.
- Reported by Miguel A. Figueroa-Villanueva and Philip Lowman.
- Generated Xcode projects for application bundles list the
CMake-generated Info.plist input file as a resource.
- The location of the input file was moved by a previous commit,
but the reference to it as a resource file was not updated.
- This change moves the file to CMakeFiles/<tgt>.dir/Info.plist
to give it a more intuitive name in the Xcode project.
- We also update the reference to point at the correct location.
- See bug #7277.
- The Xcode generator creates one Info.plist input file which is
converted at build time by Xcode and placed in the final bundle.
- The <CONFIG>_OUTPUT_NAME target property can place different content
for the exe name in Info.plist on a per-configuration basis.
- Instead of generating a per-config Info.plist input file just let
Xcode put the name in at build time using the $(EXECUTABLE_NAME) var.
- The property tracks the value formed by add_definitions
and remove_definitions command invocations.
- The string should be maintained for use in returning for the
DEFINITIONS property value.
- It is no longer used for any other purpose.
- The DEFINITIONS property was recently documented as deprecated.
- See bug #7239.
- Fix documentation of get_directory_property command.
- Convert its list of computed directory properties to be
defined/documented directory properties.
ENH: -if no compiler has been found, don't test it, and also remove the compiler
information file again. This makes optionally enabling a language work
better.
Alex
- The short-hand forms do not document the NO_* options.
- CMake 2.4 and 2.6.0 accepted them accidentally, but also
treated the options as paths.
- Now the options are accepted but do not become paths.
- The CMAKE_PREFIX_PATH and similar variables have both
environment and CMake cache versions.
- Previously the environment value was checked before the
cache value.
- Now the cache value is favored because it is more specific.
- Hints are searched after user locations but before system locations
- The HINTS option should have paths provided by system introspection
- The PATHS option should have paths that are hard-coded guesses
- Locating a header inside a framework often requires globbing
- Previously the glob was <dir>/*/Headers/<name>
- Now the glob is <dir>/*.framework/Headers/<name>
- This is much faster when <dir> is not really a framework dir
- CMAKE_FIND_FRAMEWORK and CMAKE_FIND_APPBUNDLE are supposed to specify
whether to find frameworks/appbundles FIRST, LAST, ONLY, or NEVER.
- Previously this affected only the placement of CMAKE_FRAMEWORK_PATH
and CMAKE_APPBUNDLE_PATH with respect to the other path specifiers.
- Now it behaves as documented. The entire search path is inspected for
each kind of program, library, or header before trying the next kind.
- Additionally the ONLY mode is now honored for headers so that users
do not end up with a library in framework and a header from elsewhere.
- In cmFindBase when CheckCommonArgument returns true, set newStyle
- Otherwise if there are no PATHS then the ancient-style compatibility
mode is enabled and the common argument is treated as a path.
- Add each part of the search order in a separate method.
- Collect added paths in an ivar in cmFindCommon.
- Move user path storage up to cmFindCommon and share
between cmFindBase and cmFindPackageCommand.
- Expand user path registry values up in cmFindCommon
- Enables 32-/64-bit registry view for find_package
- Disables registry expansion for paths not specified
with the PATHS argument, which is not expected.
- cmFindBase should search both 32-bit and 64-bit registry views
for FIND_PROGRAM even if CMAKE_SIZEOF_VOID_P is not set.
- Needed because the variable is not available when CMAKE_MAKE_PROGRAM
is to be found.
- The rule hash should use only commands specified by the user.
- No make output (echo and progress) rules should be included.
- No outputs or dependencies need be included. The native build tool
will take care of them.
- Option was recently added but never released.
- Custom commands no longer depend on build.make so we do
not need the option.
- Rule hashes now take care of rebuilding when rules change
so the dependency is not needed.
- In CMake 2.4 custom commands would not rebuild when rules changed.
- In CMake 2.6.0 custom commands have a dependency on build.make
which causes them to rebuild when changed, but also when any
source is added or removed. This is too often.
- We cannot have a per-rule file because Windows filesystems
do not deal well with lots of small files.
- Instead we add a persistent CMakeFiles/CMakeRuleHashes.txt file
at the top of the build tree that is updated during each
CMake Generate step. It records a hash of the build rule for
each file to be built. When the hash changes the file is
removed so that it will be rebuilt.
- The target platform does not matter for finding executables
so find_program should expand to both 32-bit and 64-bit registry
values.
- See issue #7095.
- Add an argument to registry read/write/delete methods to specify
a 32-bit or 64-bit view.
- Default is the bit-ness of the running program.
- See issue #7095.
- Revert previous change to trust user-provided full paths.
- Instead trust them only far enough to determine the source language
but still check for existence for non-generated sources.
- Create MACOSX_BUNDLE_INFO_PLIST target property to specify template.
- Look for MacOSXBundleInfo.plist.in in CMAKE_MODULE_PATH by default.
- See issue #6983.
the generator on the first configure. It either ask for a toolchain file
or asks for all the information a toolchain file might contain.
Also added option for setting non-default compilers if not cross compiling.
Fixes#6849.
Also a bit of code cleanup and re-organizing.
- Tells CMake about the KWSYS_HEADER macro.
- Enables implicit dependencies of private source files.
- When a CMake new enough to support the property is required
the "#if 0" hack can be removed from the source files.
- Allows make rules to be created with no dependencies.
- Such rules will not re-run even if the commands themselves change.
- Useful to create rules that run only if the output is missing.
-generate and install the policy documentation files
-generate and install the docbook files for cmake, ctest, cpack, ccmake (cmake-gui not yet ?)
Alex
- Previously this was done implicitly by the check for a target
link language which checked all source full paths.
- The recent change to support computing a link language without
finding all the source files skipped the implicit check.
- This change adds an explicit check to find all source files.
the argument after -Wno-dev was skipped, which happened to be the source
directory, and so the current working directory was assumed as source
directory, although it was the build directory (maybe this didn't have an
effect if there was already a CMakeCache.txt in the build dir)
Alex
- Previously all links started in 'command_' which led to conflicts
and was confusing for non-command items.
- Use a per-section name that is meaningful to humans.
- Fix link id names to be valid HTML.
- CMake 1.8 and below did not do the check but could get in
infinite loops due to the local generate step.
- CMake 2.0 added the check but failed to perform it in directories
with no targets (see bug #678).
- CMake 2.2 removed the local generate which fixed the problem but
did not remove the check.
- Between CMake 2.4 and 2.6.0rc6 the check was fixed to work even
when no targets appear in a directory (see bug #6923).
- Bottom line: the check is no longer needed.