Commit Graph

413 Commits

Author SHA1 Message Date
Brad King bd642272b9 Merge topic 'fix-CMP0049-extra-error'
b2282631 cmTarget: Do not mistake a preceding error for a CMP0049 failure
2014-07-31 09:17:41 -04:00
Nils Gladitz f86850ef60 Genex: Implement generator expressions for target PDB files. 2014-07-31 09:17:53 -04:00
Brad King b2282631f6 cmTarget: Do not mistake a preceding error for a CMP0049 failure
After calls to ProcessSourceItemCMP0049, check for an empty return
string to detect a failure instead of trusting GetErrorOccuredFlag.
The latter could have been left from a preceding non-fatal error.

Extend the RunCMake.Configure test to cover a case that exposed this
problem.
2014-07-30 13:48:33 -04:00
Brad King 3526478cc0 Tests: Activate tests accidentally excluded from Xcode
The generator name is "Xcode", not "XCode".  Fix this typo.  Explicitly
exclude the SubDirSpaces test on Xcode because it does not work.  Also
tell the RunCMake.File_Generate test when Xcode is not multi-config so
it can exlcude the OutputConflict case.

Inspired-by: Daniele E. Domenichelli <daniele.domenichelli@iit.it>
2014-07-17 09:31:53 -04:00
Brad King affe9d56a2 Allow INTERFACE_SOURCES to specify $<TARGET_OBJECTS> (#14970)
Fix cmTarget::GetSourceFiles to set EvaluateForBuildsystem on the
$<TARGET_PROPERTY:...,INTERFACE_SOURCES> generator expression so that
the $<TARGET_OBJECTS> generator expression is allowed within an
INTERFACE_SOURCES value.

Extend the InterfaceLibrary test to cover this case.  Extend the
RunCMake.TargetObjects test to cover failure of $<TARGET_OBJECTS>
when used through $<TARGET_PROPERTY:...,INTERFACE_SOURCES> in a
non-buildsystem context.
2014-07-14 09:09:32 -04:00
Brad King 2c470b775a add_library: Allow arbitrary non-linked sources in OBJECT libraries
Loosen this restriction on OBJECT libraries to allow source files of any
name to be generated by custom commands or listed for reference in IDE
projects so long as they would not affect linking of a normal library.
Update the rejection message to be more specific about the looser
restriction.

Extend the ObjectLibrary test to cover a ".cmake" file generated by a
custom command in an OBJECT library.
2014-07-09 09:43:42 -04:00
Brad King 61be345115 Merge topic 'refactor-usage-requirement-evaluation'
93790506 cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup
b5b098eb cmTarget: Simplify CMP0027 logic in processIncludeDirectories
5e07dcf7 cmTarget: Add to LinkImplementation whether each library was a genex
f77b384c cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookup
61ef8daa cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup
d9586f83 cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookup
3156275b cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup
363cd33e cmTarget: Add method to add usage requirements from linked interfaces
251e835b cmTarget: Add to LinkImplementation a backtrace for each library
848c8ccf cmTarget: Refactor LinkImplementation to allow more information
f85ccf23 cmGeneratorExpressionEvaluator: Shorten some long lines
82e91e34 cmComputeLinkDepends: Convert AddLinkEntries to a template
2014-07-07 08:54:40 -04:00
Brad King 93790506f5 cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication.  In
TargetPropertyEntry, replace the TargetName string member with a
reference to the full cmLinkImplItem that produced the entry.  This is
possible because the cmLinkImplItem is available in AddInterfaceEntries
(it was not available in GetIncludeDirectories).  Having the full
cmLinkImplItem allows processIncludeDirectories to implement CMP0027 OLD
behavior without repeating the target name lookup.

Update the RunCMake.CompatibleInterface test DebugProperties case
expected output for the new order of the messages.
2014-07-07 08:52:42 -04:00
Brad King 3156275bc7 cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication.
2014-07-07 08:52:40 -04:00
Stephen Kelly b47c125ff7 WCDH: Ensure that the prefix argument to the macro is valid.
The prefix must be a C-identifier because it is written as the
prefix of preprocessor macros and possibly structs.
2014-07-02 19:37:04 +02:00
Brad King 2ea0d6ba27 Merge topic 'fix-circular-transitive-properties-segfault'
65aa5442 Target: Return null when a transitive property is not defined.
61ce6547 Genex: Fix stack overflow in transitive property evaluation.
2014-07-02 09:54:50 -04:00
Stephen Kelly 61ce654742 Genex: Fix stack overflow in transitive property evaluation.
Commit v2.8.11~156^2~2 (Expand includes and defines transitively
in 'external' genexes., 2013-02-13) introduced a recursive loop
and a stack overflow during evaluation of a link implementation
which depends on a transitive property, such as

 add_library(empty1 ...)
 add_library(empty2 ...)
 target_link_libraries(empty1
   PRIVATE
     $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
 )

There is no use-case for code like that currently, but it should not
cause a stack overflow.

Avoid the recursion by reporting an error early if a case like this
is found.
2014-07-02 00:09:38 +02:00
Brad King 623123aaa0 Merge topic 'test-speedup-RunCMake.include_directories'
9998d78d Tests: Speed up RunCMake.include_directories test
6eee5d74 Tests: Drop broken and now unused RunCMake_TEST_FILE option
f0f15b93 Tests: Refactor RunCMake.include_directories to drop RunCMake_TEST_FILE
8707814e Tests: Refactor RunCMake.File_Generate to drop RunCMake_TEST_FILE
2014-07-01 09:23:21 -04:00
Brad King 1563668fd0 Merge topic 'vs14-generator'
f0e298ad Help: Add notes for topic 'vs14-generator'
5c105140 Tests: Simplify LoadCommand tests
b1cbd577 FindBoost: Add -vc140 mangling for VS 14
bdc7d9c8 VS14: Fix Cl and Link flag tables as previous versions
d96b3f68 VS14: Generate flag tables from MSBuild v140 tool files
65624c39 VS14: Add Visual Studio 14 generator (#14982)
8635ac23 Tests/Preprocess: Remove unnecessary VS version tests
2014-06-30 14:50:34 -04:00
Brad King 9998d78d63 Tests: Speed up RunCMake.include_directories test
Remove unnecessary language initializations.  Change the main
CMakeLists.txt project() call to specify NONE.  Use enable_language(CXX)
instead of project() in cases that need it to avoid enabling C too.
2014-06-30 14:37:38 -04:00
Brad King 6eee5d7449 Tests: Drop broken and now unused RunCMake_TEST_FILE option
We cannot use -DRunCMake_TEST=${RunCMake_TEST_FILE} because test cases
use project(${RunCMake_TEST}) and the project name cannot be a path to a
file.  The parent and grandparent commits removed the only uses of the
option.  Drop it now.
2014-06-30 14:35:52 -04:00
Brad King f0f15b93bd Tests: Refactor RunCMake.include_directories to drop RunCMake_TEST_FILE
Drop use of RunCMake_TEST_FILE and pass the test file in through a
definition in RunCMake_TEST_OPTIONS.
2014-06-30 14:35:00 -04:00
Brad King 8707814e78 Tests: Refactor RunCMake.File_Generate to drop RunCMake_TEST_FILE
Drop use of RunCMake_TEST_FILE and pass the test file in through a
definition in RunCMake_TEST_OPTIONS.
2014-06-30 14:32:51 -04:00
Brad King 3138da6e67 Merge topic 'install-messages'
d19b64d6 install(DIRECTORY): Add MESSAGE_NEVER option to avoid output (#13761)
c9568de5 install: Add CMAKE_INSTALL_MESSAGE variable (#13761)
ec7cf7ea install: Thread message level setting through internal API
abebcd23 file(INSTALL): Add undocumented options to control output verbosity
464567a5 file(INSTALL): Report existing DIRECTORY as Up-to-date
f701b0b7 file(INSTALL): Do not pre-create DESTINATION for DIRECTORY
f0a01962 cmInstallTargetGenerator: Drop default constructor arguments
67815894 Help: Add install() command document section headers
2014-06-27 09:42:42 -04:00
Brad King 65624c39e3 VS14: Add Visual Studio 14 generator (#14982)
Call the generator "Visual Studio 14" without any year because this
version of VS does not provide a year in the product name.

Copy cmGlobalVisualStudio12Generator to cmGlobalVisualStudio14Generator
and update version numbers accordingly.  Add the VS14 enumeration value.
Teach the platform module Windows-MSVC to set MSVC14 and document the
variable.  Teach module InstallRequiredSystemLibraries to look for the VS
14 runtime libraries.

Teach tests CheckCompilerRelatedVariables, VSExternalInclude, and
RunCMake.GeneratorToolset to treat VS 14 as they do VS 10, 11, and 12.

Co-Author: Pawel Stopinski <diokhan@go2.pl>
2014-06-25 14:51:19 -04:00
Brad King d19b64d671 install(DIRECTORY): Add MESSAGE_NEVER option to avoid output (#13761)
Installing large directories, e.g., the output of a doxygen run, prints
one line per file resulting in too much noise in the build output.  Add
an option to the install(DIRECTORY) command to not print anything upon
make install.

Extend the RunCMake.install test with cases covering MESSAGE_NEVER
behavior of the install(DIRECTORY) command.

Suggested-by: Stefan Eilemann <Stefan.Eilemann@epfl.ch>
2014-06-24 13:18:20 -04:00
Brad King c9568de52c install: Add CMAKE_INSTALL_MESSAGE variable (#13761)
Create a variable to allow users to control which installation
messages are printed.  In particular, provide a "LAZY" setting
that prints "Installing" messages but not "Up-to-date" messages.
This is desirable for incremental re-installations.

Suggested-by: J Decker <d3ck0r@gmail.com>
2014-06-24 13:18:20 -04:00
Brad King abebcd235c file(INSTALL): Add undocumented options to control output verbosity
Create options "MESSAGE_ALWAYS", "MESSAGE_LAZY", and "MESSAGE_NEVER" to
specify whether to print the "Installing" and "Up-to-date" messages.
Extend the RunCMake.file test with cases covering these options.
2014-06-24 13:11:45 -04:00
Brad King 464567a577 file(INSTALL): Report existing DIRECTORY as Up-to-date
Teach cmFileCopier::InstallDirectory to detect whether the destination
directory exists.  If so, report it as "Up-to-date" instead of
"Installing".  This resolves message asymmetry with file installations.

Extend the RunCMake.file and RunCMake.install tests to check the
installation output on both the first and second run.

Suggested-by: J Decker <d3ck0r@gmail.com>
2014-06-24 12:52:11 -04:00
Brad King 7abd574798 cmake: Add '-E env' command-line tool
Extend the cmake command-line interface to support

 cmake -E env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...

This will be useful to run processes with modified environments
without using a shell or a full "cmake -P" script to wrap it.

Extend the RunCMake.CommandLine test to cover success and failure cases.

Inspired-by: Jonathan Bohren <jbo@jhu.edu>
2014-06-23 16:47:49 -04:00
Brad King 487b6ccdcd Merge topic 'WriteCompilerDetectionHeader-compiler-versions'
ddec418a Features: Add compiler version support to WriteCompilerDetectionHeader.
b7029576 Project: Add configurable name for version computation macros.
78acaafe Project: Separate simulated compiler id from version detection.
567af1a5 WCDH: Issue a better message for version compatibility.
2014-06-10 09:17:43 -04:00
Brad King b1c113d9a7 cmake: Do not open directories as scripts (#14966)
Check if a file path is a directory before opening it.  Extend the
RunCMake.CommandLine test with a case running "cmake -P" on a directory.
2014-06-09 16:21:11 -04:00
Brad King 0366ba5db6 Tests: Fix RunCMake.TargetSources on Xcode 1.5
Xcode 1.5 does not support multiple configurations.  The generator also
adds some sources internally that cause extra OriginDebug output.
Update the expected output to tolerate it.
2014-06-06 10:28:32 -04:00
Stephen Kelly 567af1a596 WCDH: Issue a better message for version compatibility. 2014-06-05 13:58:27 +02:00
Brad King 528e8af19f Allow a toolchain file to specify a generator toolset
Delay use of CMAKE_GENERATOR_TOOLSET until the CMakeSystem.cmake
file has been configured and loaded during the first project() or
enable_language() command.  This gives the toolchain file named by
CMAKE_TOOLCHAIN_FILE a chance to set CMAKE_GENERATOR_TOOLSET.  This
point is still early enough to set the generator toolset prior to
the initialization of any languages that might use the toolset.

The cmake::GeneratorToolset member variable remains an indication
of what was specified by the -T option or loaded from the cache.
It does not need to be updated based on the toolchain file setting.
The cmMakefile::TryCompile can still pass cmake::GeneratorToolset
into the inner instance because the try-compiled project will do
platform and language initialization using the CMakeSystem module
configured for the outer project.

Extend the RunCMake.GeneratorToolset test with cases that use a
toolchain file to set CMAKE_GENERATOR_TOOLSET.
2014-06-04 14:27:02 -04:00
Brad King 99d6fa0aa1 Merge topic 'fix-build-crash-on-bad-generator'
44e2923f cmake: Fix --build crash on bad CMAKE_GENERATOR in cache
2014-06-04 09:18:46 -04:00
Brad King 44e2923f33 cmake: Fix --build crash on bad CMAKE_GENERATOR in cache
If we fail to create the generator named by CMAKE_GENERATOR, exit
with an error message instead of crashing.  While at it, fix the
wording of the error message when CMAKE_GENERATOR is not set.

Extend the RunCMake.CommandLine test with cases covering the
"cmake --build" option when the named directory does not provide
a CMakeCache.txt with a valid CMAKE_GENERATOR.
2014-06-03 11:52:19 -04:00
Brad King 7b888a5624 Merge topic 'feature-extensions-by-default'
60a981ea Features: Enable compiler extensions by default.
2014-06-02 10:44:28 -04:00
Stephen Kelly 60a981ea8e Features: Enable compiler extensions by default.
Compilers enable their extensions by default, and disabling them
implicitly can lead to results which are surprising or non-obvious
to debug.

 http://public.kitware.com/pipermail/cmake-developers/2014-May/010575.html
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/10214
 https://www.mail-archive.com/cmake-developers@cmake.org/msg10116.html
 (Compiler feature extensions by default, 29 May 2014)
2014-05-31 12:16:12 +02:00
Stephen Kelly fb2fa47656 Genex: Clarify error message on use with non-binary targets (#14899). 2014-05-29 11:29:31 +02:00
Brad King 8df4d03d99 Merge topic 'cpack-properties'
d0b1d2a6 CPackWiX: Implement CPACK_NEVER_OVERWRITE and CPACK_PERMANENT properties
15a8af21 Add an "installed file" property scope
2014-05-28 12:34:36 -04:00
Nils Gladitz 15a8af21e8 Add an "installed file" property scope
Teach set_property and get_property an "INSTALL" property type to be
associated with install-tree file paths.  Make the properties available
to CPack for use during packaging.  Add a "prop_inst" Sphinx domain
object type for documentation of such properties.
2014-05-28 12:28:18 -04:00
Ben Boeckel 9ba91463e6 tests: test CMP0053 in WARN mode when watching variables
When CMP0053 is in WARN mode, variables get expanded twice, leaking the
fact that the string was expanded twice and changing behavior. Instead,
suppress variable watches when running the expansion to trigger the
CMP0053 warning.
2014-05-22 11:13:29 -04:00
Brad King 5ce40619db Merge topic 'COMPILE_FEATURES-genex'
0dfe395e Features: Add COMPILE_FEATURES generator expression.
aa8a6fce cmMakefile: Add methods for checking availability of a feature.
b6dedf03 cmMakefile: Extract CheckNeeded{C,Cxx}Language methods.
8dd129df cmMakefile: Extract CompileFeaturesAvailable method.
6b9b2fff cmMakefile: Extract CompileFeatureKnown method.
2014-05-22 10:37:48 -04:00
Stephen Kelly 0dfe395e3c Features: Add COMPILE_FEATURES generator expression.
Allow setting build properties based on the features available
for a target.  The availability of features is determined at
generate-time by evaluating the link implementation.

Ensure that the <LANG>_STANDARD determined while evaluating
COMPILE_FEATURES in the link implementation is not lower than that
provided by the INTERFACE of the link implementation.  This is
similar to handling of transitive properties such as
POSITION_INDEPENDENT_CODE.
2014-05-21 17:22:32 +02:00
Brad King 2c448dbfe7 file: Report system error on failure to open file 2014-05-20 11:07:51 -04:00
Brad King c1edede31f Merge topic 'compile-features-C-language'
e0890d03 Features: Extend concept to C language.
2014-05-20 09:40:14 -04:00
Brad King a339ea6529 Xcode: Add source file property to control file type (#14854)
Add source file properties to control Xcode file type attributes:

  XCODE_EXPLICIT_FILE_TYPE   => explicitFileType
  XCODE_LAST_KNOWN_FILE_TYPE => lastKnownFileType

Add a RunCMake.XcodeProject test to verify generated project content.
2014-05-15 14:34:52 -04:00
Stephen Kelly e0890d03a4 Features: Extend concept to C language.
Add properties and variables corresponding to CXX equivalents.

Add features for c_function_prototypes (C90), c_restrict (C99),
c_variadic_macros (C99) and c_static_assert (C11). This feature
set can be extended later.

Add a <PREFIX>_RESTRICT symbol define to WriteCompilerDetectionHeader
to conditionally represent the c_restrict feature.
2014-05-15 00:15:18 +02:00
Brad King 2e347eb183 Merge topic 'WriteCompilerDetectionHeader-module'
62a4a67d Add the WriteCompilerDetectionHeader module.
2014-05-14 13:58:30 -04:00
Stephen Kelly 62a4a67dc5 Add the WriteCompilerDetectionHeader module.
Provide a function to write a portable header to detect compiler
features.  Generate a preprocessor #error for unknown compilers
and compiler versions whose features are not yet recorded.  This
error condition might be relaxed in the future, but for now it
is useful for verification of expectations.
2014-05-14 13:57:30 -04:00
Brad King f20bb8f003 Merge topic 'minor-cleanups'
bc9a8bba Makefile: Undef FEATURE_STRING iteration define after use.
eb638c75 Tests: Make CompileFeatures feature list lang-specific.
e2f09aff CMakeConfigurableFile: Remove excess newline.
5109b042 Features: Fix GNU 4.8.1 version test.
6a9fdbeb Test: Parameterize the language in the CompileFeature test.
f5bf9d43 Tests: Make CompileFeature tests use highest standard known.
2014-05-12 09:31:06 -04:00
Stephen Kelly eb638c75cc Tests: Make CompileFeatures feature list lang-specific. 2014-05-10 13:05:46 +02:00
Brad King 911cc9a39e cmTarget: Evaluate CMP0026 and CMP0051 in calling context
These policies should be checked at the call site that tries to access
the LOCATION or SOURCES property, not the directory scope containing the
target.  Thread the caller context through cmTarget::GetProperty to use
for checking the policy setting and emitting a diagnostic with proper
backtrace.

Extend the RunCMake.CMP0026 and RunCMake.CMP0051 tests with
cross-directory cases.
2014-05-09 11:24:15 -04:00
Brad King 23409f50f1 cmTarget: Evaluate CMP0026 in calling context
This policy should be checked at the call site that tries to access the
LOCATION property, not the directory scope containing the target.
Thread the caller context through cmTarget::GetProperty to use for
checking the policy setting and emitting a diagnostic with proper
backtrace.

Extend the RunCMake.CMP0026 test with a cross-directory case.
2014-05-09 11:12:48 -04:00