Let us take an example of a project that has some tests in a component
that need to be installed into a dedicated test package. The user
expectation is that the result could be achieved by typing the
following:
make
make tests
make install
DESTDIR=/testpkgs make install-tests
However this results in test components in the default installation as
well as the testpkg.
Add an EXCLUDE_FROM_ALL option to the install() command to tell it that
the installation rule should not be included unless its component is
explicitly specified for installation.
While evaluating `if(MATCHES)` we get a `const char*` pointer to the
string to be matched. On code like
if(CMAKE_MATCH_COUNT MATCHES "Y")
the string to be matched may be owned by our own result variables.
We must move the value to our own buffer before clearing them.
Otherwise we risk reading freed storage.
The add_custom_command(TARGET) signature only works for targets defined
in the current directory. Clarify this in the error message when the
target exists but was defined elsewhere.
Inspired-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
70788e92 Remove temporary allocations when calling cmHasLiteral{Suf,Pre}fix.
bd2384f5 Optimize cmMakefile::ExpandVariablesInStringNew.
ad9394f4 Remove temporary allocations in cmMacroHelper::InvokeInitialPass.
f9599ed4 Remove temporary allocations by extending the lifetime of the retval.
275f2a85 Remove temporary allocations when calling cmGeneratorTarget::GetName.
Since commit v3.4.0-rc1~5^2~1 (VS: Add support for selecting the Windows
10 SDK, 2015-09-30) the VS 2015 generator requires a Windows 10 SDK to
be available when CMAKE_SYSTEM_VERSION specifies Windows 10 (e.g. when
building on a Windows 10 host). Howewver, it is possible to install VS
2015 without any Windows 10 SDK. Instead of failing with an error
message about the lack of a Windows 10 SDK, simply tolerate this case
and use the default Windows 8.1 SDK. Since building for Windows Store
still requires the SDK, retain the diagnostic in that case.
Refactoring merged by commit 9afbb733ec (Merge topic
'use-generator-target', 2015-10-20) in and around commit 381e7afd
(cmExportSet: Store a cmGeneratorTarget, 2015-10-17) forgot to update
one place in this method. This leads to a crash in code such as
add_library(A a.c)
add_library(B b.c)
target_link_libraries(B A)
install(TARGETS B DESTINATION lib EXPORT ExpB)
install(EXPORT ExpB DESTINATION lib/cmake/test)
add_executable(C c.c)
install(TARGETS C DESTINATION bin EXPORT ExpC)
Fix the target name reference to avoid using an unpopulated Target
pointer.
When the first argument passed is a std::string, we need to take it
by const&, otherwise we copy the string and trigger a temporary
allocation. This patch removes a few 10k temporary allocations when
running the CMake daemon on the KDevelop build dir.
This hotspot was found with heaptrack.
We can remove the temporary allocations required for the
default-constructed t_lookup passed into the openstack by refactoring
the code slightly. Furthermore, we use a vector instead of a stack,
since the latter is based on a deque which is not required for a
heap / lifo structure.
This patch removes ~215k allocations.
This hotspot was found with heaptrack.
This code used to convert std::string's to raw C strings only to
put that back into a std::string. This patch thus removes ~70k
temporary allocations when running the CMake daemon on KDevelop.
This hotspot was found with heaptrack.
This happens quite often from within comparisons such as in
NamedGeneratorTargetFinder or FindGeneratorTargetImpl. It is the
top hotspot of both, number of allocations as well as number of
temporary allocations - the majority of calls lead to temporary
allocations.
In raw numbers, this patch removes ~1E6 temporary allocations of
1.5E6 temporary allocations in total when running the cmake daemon
on the KDevelop build dir. That is 2/3 of the total.
This hotspot was found with heaptrack.
Since this command was introduced in 2002 it has incorrectly constructed
the child process command line by concatenating arguments separated by
spaces with no quoting. Fix this by passing the command argument vector
directly to RunSingleCommand without an intermediate quoting and
re-parsing step.
Reported-by: Andrey Pokrovskiy <wonder.mice@gmail.com>
1040e690 cmSystemTools: Teach RunSingleCommand to merge child pipes when possible
ce3b713b cmSystemTools: Simplify RunSingleCommand output string construction
dc039cc0 cmSystemTools: Drop redundant condition in RunSingleCommand
ffa2a8c9 cmSystemTools: Rename OUTPUT_NORMAL to OUTPUT_FORWARD to clarify its purpose
92e9bb21 cmcmd.cxx: Remove unused code in __run_iwyu implementation
fb1526f5 cmake: Change `-E chdir` to pass through stdout/stderr directly
Audit the code to make sure there are no callers that use OUTPUT_MERGE
with separate capture strings. Then change RunSingleCommand to
implement output merging by giving the child process a single pipe for
both its stdout and stderr descriptors. This will more cleanly merge
the content on atomic write boundaries in the child instead of on
arbitrary buffering boundaries in the parent.
The OUTPUT_NORMAL value is not really "normal" and has only one caller.
Rename it to OUTPUT_FORWARD to clarify that we are explicitly forwarding
the output.
aea1b036 Fix export of STATIC library PRIVATE dependencies with CMP0022 NEW
e5cbec14 Tests: Use CMP0022 NEW behavior in some ExportImport cases
0ca122fc Tests: Isolate policy changes in ExportImport test
Some compilers may add their own RPATH entries when invoking the linker.
For example, a GCC installation may contain the following definition in
the specs file:
*link_libgcc:
%D -rpath <<some specific rpath in which libstdc++.so can be found>>
In this case binaries may contain RPATH entries that CMake did not add.
When we update the RPATH on installation we must preserve these entries
even if CMake thinks the INSTALL_RPATH value should be empty.
Fix this by always using file(RPATH_CHANGE) and teach it to behave as
file(RPATH_REMOVE) if the actual RPATH in the file is empty after
replacing the build-tree RPATH with the install-tree RPATH. This will
preserve any compiler-added RPATH value instead of removing it.
The target_link_libraries command records the PRIVATE dependencies of a
STATIC library in INTERFACE_LINK_LIBRARIES as "$<LINK_ONLY:dep>". This
hides the target name from export namespacing logic inside a generator
expression. When user-written generator expressions reference a target
name they must put it inside a "$<TARGET_NAME:dep>" expression to allow
the export logic to rename the target. In the case that the private
dependency is not already a generator expression, target_link_libraries
must use "$<LINK_ONLY:$<TARGET_NAME:dep>>" to allow the export logic to
rename the target.
Reported-by: Tamás Kenéz <tamas.kenez@gmail.com>
Since commit v3.3.0-rc1~410^2~3 (ctest_test: Add QUIET option,
2015-02-17) if tests fail when QUIET is used one sees:
The following tests FAILED:
but not the subsequent line(s) indicating which tests failed.
Restore the list of failed tests.
Expand the -W set of cmake options to include support for the -Werror
and -Wno-error format, which is used to control upgrading and
downgrading warning and error messages. Implement support for these new
formats for the dev and deprecated message types.
Add tests and updated documentation for new options.
a57caf7e VS: Fix Windows 10 SDK version selection (#15831)
ad594de8 cmSystemTools: Add VersionCompareEqual helper
c173e37f VS: Do not select a partial Windows 10 SDK folder (#15831)
b3677b35 VS: Map the link `/debug` to its IDE property
c22da7cf VS: Drop unused condition in link debug flag generation
4ca9df8b cmIDEOptions: Add support for case-insensitive flags
In commit v3.4.0-rc1~5^2~1 (VS: Add support for selecting the Windows 10
SDK, 2015-09-30) we added Windows 10 SDK selection choosing the most
recent SDK that is not newer than the target version. This is backward
because it should be up to the application code to not use APIs newer
than the target version. It is up to the build system to provide a SDK
that has at least the APIs expected to be available for the target
version. Furthermore, since the default target version is the host
version of Windows, the old approach breaks when the only SDK available
is for a newer version of Windows.
Fix this by always selecting a Windows 10 SDK if one exists. Use the
SDK for the exact version if is available. Otherwise use the latest
version of the SDK available because that will have at least the APIs
expected for the target version.
Fix the link flag table entries for this flag to be case-insensitive.
Also fix the VS 2015 value for the build property enumeration name.
This causes `linkOptions.Parse(...)` to correctly extract the `/debug`
flag and map it to the IDE property instead. Therefore we do not need
to look for the flag explicitly when initializing the property.
Starting with VS 2015 the GenerateDebugInformation build property is an
enumeration (`No`, `Debug`, `DebugFastLink`) instead of a boolean value
(`false`, `true`). For now we simply change to `No` and `Debug` fix
current behavior. Support for `/debug:fastlink` can be added later.
There were issues in the special-character-escaping and line-wrapping
code which caused DragNDrop packaging to fail mysteriously at a later
step with parsing errors in the `sla.r` file generated by the following
code.
d8bc26a0 Xcode: Parse variant and genex for CMAKE_XCODE_ATTRIBUTE (#14947)
dc0ddb9e Xcode: Store configuration name along with XcodeObject (#14947)
28f98cee Xcode: Make CMAKE_XCODE_ATTRIBUTE calculation last step (#14947)
28db2268 Xcode: Factor out XCODE_ATTRIBUTE_ variant filter (#14947)
Before this change backslashes in strings were escaped during compile
flags adds via AppendFlag(). But global flags like OTHER_CPLUSPLUSFLAGS
are not added as flags but as plain strings so they were not escaped
properly.
Now the escaping is performed within cmXCodeObject::PrintString() which
ensures that strings are always encoded.
Create a `CMAKE_XDGDATA_DIR` option and add a corresponding flag to the
`bootstrap` script. This is needed for multiarch layouts where the
prefix is `/usr/${host}` but where architecture-independent files (like
the XDG-specific ones) are installed to `/usr/share`.
a5dd0c9d Add option to use a system-installed KWIML
036b6ef7 Port CMake from cmIML to KWIML
12293371 Merge branch 'upstream-KWIML' into import-kwiml
3fdbb0a8 KWIML 2015-12-09 (43f9f8d0)
55b21d07 Add script to update KWIML from upstream
c7d9a249 Utilities/KWIML: Drop sources to make room for fresh import
24cdb9df CMake: Mimic NSIS options dialog in WiX installer
de77d4a7 CPackWIX: Allow multiple patch files and diagnose if any are missing
38d723b3 CPackWIX: Allow patching of shortcut components
ab8a2808 cmake_parse_arguments: consider duplicate keyword as warning
e8b14831 CMakeParseArguments: replace by native cmake_parse_arguments command
cbbdfc2b CMakeParseArguments: add a RunCMake test suite
The behaviour of double specified keywords is rather undefined or at
least not clearly documented. This change introduces a strict check and
emits a warning in case a keyword has been specified more than once.
Implement a native `cmake_parse_arguments` command that is fully
compatible with the documented behaviour of the previous implementation.
Leave the CMakeParseArguments module empty but existing for
compatibility.
CPACK_WIX_PATCH_FILE now accepts a list of patch files.
An error will now be produced if any of the patch files is missing.
Previously this would be silently ignored.
This patch solves the problem of installing both: Device and Simulator
libraries on iOS. Before only one of them was installed.
If the IOS_INSTALL_COMBINED property is set on a target, a
special install hook will be activated which builds the corresponding
target and combines both at the install location.
The original patch was contributed by Ruslan Baratov, and polished by
Gregor Jasny.
The WIX generator incorrectly looked for installed file properties
by relative paths that included the component specific staging
directory prefix.
Remove that prefix in installed file property lookups when
generating packages with components.
Remove the duplicate code in cmake::Configure to set the cache variables
for the warning message suppression. Replace it with calls to the
dedicated methods to carry this out.
Create a new dialog window for the cmake-gui that provides controls for
setting the state of suppression of developer and deprecated warning
messages. This replaces the previous single checkbox for setting the
state of suppression of developer warnings.
Added a note for the new functionality to the release notes.
Without this patch, `SET (GRAPHVIZ_GRAPH_NAME "hello world")` does not
work (it results in a parsing error in GraphViz when the generated
output is processed), but `SET (GRAPHVIZ_GRAPH_NAME "\"hello world\"")`
does.
If multiple input files are provided then the destination must be a
directory. If only one input file is provided then destination may be
either a file or directory.
A typical iOS application bundle (also Framework Bundle) contains the
application executable and any resources used by the application (for
instance, the application icon, other images, and localized content) in
the top-level bundle directory. The same rule applies to Framework
Bundles.
aac633d5 Explicitly enable deprecated warnings by default.
e8974b62 Modify dev warning options to affect deprecated warnings.
b146747e Consistent documentation for deprecation message variables.
da688bcb Add -W options to control deprecated warning messages.
07388f83 Refactor the -W options parser to be generic.
246b0bfb Explicitly enable author (dev) warnings by default.
deec3a3f Make message suppression more consistent.
aa427a42 Tests: Revise message in RunCMake.CommandLine -Wdev case
Add necessary bits to support the NIOS2 little-endian CPU.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Walter Goossens <waltergoossens@home.nl>
When both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE are defined,
use the license file for all languages instead of looking for a license
file for each language. Also expand the documentation on the SLA
variables.
Since commit v3.1.0-rc1~110^2 (Tolerate symlinks during RPATH ordering,
2014-09-09) we call realpath() for every directory ordering constraint
check. On some platforms/filesystems this is slow, so memoize the
result of the call for each directory.
Explicitly enable deprecated warnings by default, via the
cmake::GetSuppressDeprecatedWarnings method, which signals
suppression is turned off unless the CMake variables are set
as required.
Add tests and update the documentation for the new
functionality.
Change the '-Wdev' and '-Wno-dev' options to also enable and
suppress the deprecated warnings output, via the
'CMAKE_WARN_DEPRECATED' CMake variable, by default. This
action does not happen if the user specifies a deprecated
warning message option.
Add tests and update the documentation for the new
functionality.
Add 'deprecated' warning options type, to allow setting
CMAKE_WARN_DEPRECATED via the -W '-Wdeprecated' and
'-Wno-deprecated' options.
Add tests for new options and updated documentation.
Refactor the -Wdev and -Wno-dev options parser to use a generic -W
parser that follows the GCC pattern, excluding support for
-Werror=TYPE and -Wno-error=TYPE formats for now.
Explicitly enable author warnings by default, via the
cmake::GetSuppressDevWarnings method, which signals suppression
is turned off unless the CMake variables are set as required.
Add test cases for author and deprecated messages displayed by
default.
Make the message suppression more consistent, by adding a check
for the message related CMake variables in cmake::IssueMessage,
which allows callers of IssueMessage other than the message
command to behave as expected. Also added a check for
CMAKE_SUPPRESS_DEVELOPER_WARNINGS in the message command to
mirror the deprecated message type behaviour.
Added a 'force' flag to the cmake::IssueMessage method, to
make the message suppression consistent, when setting the
message related CMake variables directly in a CMake file.
Expand message command tests to cover the AUTHOR_WARNING message
type as well.
We enforce policy push/pop balance around any scope that pushes/pops a
snapshot. Therefore a snapshot may never reference entries of
PolicyStack that were created in nested scopes. Free storage of
short-lived policy stack entries when they are popped.
Add a method to increment an iterator (follow the "up" pointer) to the
previous level in the stack of scopes and free storage of the top of the
stack if possible. This will allow short-lived scopes to be created and
destroyed by matching Push/Pop pairs without accumulating storage.
Logically the method pushes a nested scope on top of a given scope
because the "up" pointer sequence forms a stack independent of any
other branches of the tree.
Everywhere we use cmMakefile::ScopePushPop to manage variable scopes
also expects policy scopes to be balanced. There is no place that we
use cmMakefile::PolicyPushPop without also using ScopePushPop. Relieve
PolicyPushPop of responsibility for policy scope balance checks by
moving it to ScopePushPop.
The PolicyPushPop constructor arguments and Quiet method were used to
pass non-default arguments to PushPolicy and PopSnapshot, but no clients
use them anymore.
The `PopPolicyBarrier` method is actually responsible for closing any
scope opened by creating a snapshot. Rename it to `PopSnapshot` and add
a comment explaining the purpose of the poilcy-scope-specific part of
the method.
Since commit v3.4.0-rc1~179^2~1 (cmState: Add a VariableScope snapshot
type, 2015-08-23) the snapshot stack may have a VariableScopeType entry.
Skip over these when constructing the call stack, just as we do for
policy scopes. Otherwise we report the command causing the variable
scope to be entered twice (e.g. find_package while loading a package
version file).
Change the Cobertura handler to look for an environment variable
called "COBERTURADIR" which contains the directory where the
coverage.xml file is found. If that variable doesn't exist,
continue to use the default of the binary directory.
Update the test to use an appropriate value in the environment
variables.
The change in commit f88533cc (CPackDMG: Add support for multilingual
SLAs, 2015-10-19) accidentally used CPACK_DMG_LANGUAGES in its
implementation instead of the intended CPACK_DMG_SLA_LANGUAGES added to
the documentation.
65b86612 Merge branch 'backport-fix-autodef-bigobj-64' into fix-autodef-bigobj-64
c7ddc5f4 Fix auto export symbols for Dlls containing /bigobj for 64bit builds.
75004280 Fix auto export symbols for Dlls containing /bigobj for 64bit builds.
This fixes a bug where 64 bit builds with /bigobj incorrectly determined
that the object files were not 64 bit. This manifested itself with
printf type functions showing up as undefined because the leading
underscore was being removed and should not be removed.
This fixes a bug where 64 bit builds with /bigobj incorrectly determined
that the object files were not 64 bit. This manifested itself with
printf type functions showing up as undefined because the leading
underscore was being removed and should not be removed.
If a custom command has a SYMBOLIC output (that is never actually
created) then do not mark the custom command build statement as
'restat'. Otherwise other custom commands that depend on the symbolic
output may not always re-run because after running the first custom
command Ninja 'restat' will detect that the output timestamp did not
change and skip its dependents.
This was observed with the ExternalProject BUILD_ALWAYS option where
Ninja would not re-run the 'install' step each time 'build' re-runs.
Move generation of 'restat = 1' from the CUSTOM_COMMAND rule to every
build statement using it. This will allow future selection of this
option on a per-custom-command basis.
Our check of CMAKE_PLATFORM_NO_VERSIONED_SONAME, originally added by
commit v3.1.0-rc1~416^2 (Add basic Android platform module, 2014-06-06),
was dropped accidentally by commit v3.4.0-rc1~250^2~21
(cmGeneratorTarget: Move GetLibraryNames from cmTarget, 2015-08-04).
Restore the check in the new location of the GetLibraryNames method.
Our check of CMAKE_PLATFORM_NO_VERSIONED_SONAME, originally added by
commit v3.1.0-rc1~416^2 (Add basic Android platform module, 2014-06-06),
was dropped accidentally by commit v3.4.0-rc1~250^2~21
(cmGeneratorTarget: Move GetLibraryNames from cmTarget, 2015-08-04).
Restore the check in the new location of the GetLibraryNames method.
MS tools have a limit on the number of symbols that can be listed
in a `.def` file. If multiple `.obj` files provide a symbol then
avoid listing it more than once in the generated `.def` file to
avoid counting toward the limit.
Refactoring in commit v3.4.0-rc1~74^2~1 (MSVC: Rewrite manifest file
handling with Makefile and Ninja, 2015-09-15) broke handling of this
option. Fix it and add a test case.
The -T parameter to CMake may now be specified through cmake-gui via a
new text field in the first-time configure wizard (below the generator
chooser).
The generator factories specify whether or not they support toolsets.
This information is propagated to the Qt code and used to determine if
the selected generator should also display the optional Toolset widgets.
4bca9401 Improve appearance of CMake .dmg package on OS X
c4b9ee18 CPack/DragNDrop: Update documentation to include new variables
167a4655 CPack/DragNDrop: Optionally run an AppleScript when making a package
9c1dfbfd CPack/DragNDrop: Place the background image file in a hidden folder
47302038 CPack/DragNDrop: Use source file extension for background image
While the DragNDropGenerator supports custom DS_Store and backgrounds,
it is still very hard to automatically setup nice looking packages. The
primary issue is that the DS_Store embeds the name of the volume in the
path to backgrounds, which means that if a package embeds the version in
its volume name a new DS_Store must generated for each release.
Instead one now can use applescript to setup the DS_Store.
This change also ensures that temporary RW image has enough space for
these changes, creating 1 MB dummy padding file, that is later removed
from the image.
Co-Author: Adam Strzelecki <adam.strzelecki@java.pl>
By using a hidden folder we avoid the need to mark the file as hidden
from finder, and it makes it easier for future work to refer to the
background image file.
Instead of blindly copying the `CPACK_DMG_BACKGROUND_IMAGE` file to
`background.png`, we instead use the same file extension as the source
image. This is needed for proper support of multi resolution `tif`
backgrounds.
The top-level WiX feature implicitly created by the WIX generator
represents the package as a whole.
As such it does not make sense to allow installer users to deselect
it from the installation.
Suggested-by: Mark Stijnman
The moved-from location checks for the existence of whether certain
generators are needed for any target in a loop, rather than whether
the current target has an install rule.
This was introduced in commit v3.4.0-rc1~275^2~3 (cmInstallCommand: Move
the SetHaveInstallRule invocation., 2015-07-28). Move the
SetHaveInstallRule call to a more-obvious place where the
cmInstallTargetGenerator is constructed.
Commit c389f8bb (cmLocalGenerator: Port Find method away from
GetGeneratorTarget, 2015-10-25) ported the implementation of
FindGeneratorTargetToUse away from the FindTargetToUse method,
but neglected to handle alias targets.
The latter method has a parameter to determine whether to
include alias targets in the search, but as that is only
needed at configure time, this generate-time equivalent does
not need the condition.
Multiple languages for SLAs and the SLA UI can be added via the CPack
variables CPACK_DMG_SLA_DIR and CPACK_DMG_SLA_LANGUAGES. For each
language defined in the languages variable, CPack will search for
<language>.menu.txt and <language>.license.txt in CPACK_DMG_SLA_DIR.
If the sla directory variable is not defined, the old behaviour using
CPACK_RESOURCE_FILE_LICENSE is retained.