Commit Graph

524 Commits

Author SHA1 Message Date
Brad King 86b003c3c6 Merge topic 'add_custom_command-no-INTERFACE-lib'
2600e923 Disallow INTERFACE libraries with add_custom_command(TARGET).
2014-03-20 09:22:12 -04:00
Stephen Kelly 2600e923a6 Disallow INTERFACE libraries with add_custom_command(TARGET).
Don't attempt to trace their dependencies.
2014-03-19 15:51:21 +01:00
Clinton Stimpson 98383f802a Unicode: check encoding of files given to configure_file.
UTF-16 and UTF-32 files are rejected.
2014-03-17 14:01:55 -06:00
Daniele E. Domenichelli cc5a0d8f42 FindPkgConfig: More unit tests 2014-03-17 18:10:59 +01:00
Daniele E. Domenichelli 7f857775e2 CheckTypeSize: Add unit test to cover the no-C case 2014-03-17 17:36:14 +01:00
Brad King 41b82db685 Merge topic 'FindPkgConfig_Extend-PKG_CONFIG_PATH'
3df51470 FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables (#12926)
2014-03-17 09:49:58 -04:00
Daniele E. Domenichelli 3df5147043 FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables (#12926)
Use CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH
cache and environment variables to extend PKG_CONFIG_PATH before calling
pkg-config.

In each of the path in these variables it searches for lib/pkgconfig.
Then, depending on the system, it searches for
lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig (debian) or for
lib64/pkgconfig (other 64 bit unixes). If any of these path is found,
it is appended to the PKG_CONFIG_PATH enviromnent variable.

Add two new arguments to the pkg_check_module and pkg_search_module
macro, NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH. The new signature
are therefore:

   pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
                     [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
                     <MODULE> [<MODULE>]*)
   pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
                     [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
                     <MODULE> [<MODULE>]*)

By default, if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later (in
order to keep compatibility with the previous behavior), or if
PKG_CONFIG_USE_CMAKE_PREFIX_PATH is set, the CMAKE_PREFIX_PATH,
CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment
variables will be added to pkgconfig search path.

The NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH arguments disable this
behavior for the cache variables and the environment variables,
respectively, similarly to the find_package() command.
2014-03-17 09:43:08 -04:00
Brad King 6e466c6f2e Merge branch 'master' into CONFIG-LOCATION-CMP0026 2014-03-17 09:31:21 -04:00
Stephen Kelly c903b5319b cmTarget: Restore <CONFIG>_LOCATION to CMP0026 OLD behavior (#14808)
Restore support for the undocumented <CONFIG>_LOCATION target property
removed by commit v3.0.0-rc1~175^2 (cmTarget: Remove support for
<CONFIG>_LOCATION property, 2013-12-30) as part of the CMP0026 OLD
behavior.
2014-03-17 09:30:39 -04:00
Brad King a25b809f20 Tests: Check find_dependency empty extra arguments
Add cases for empty arg 2 and arg 3.
2014-03-13 15:57:03 -04:00
Brad King d363cbf315 Tests: Make RunCMake.find_dependency tolerate line number changes 2014-03-13 15:47:08 -04:00
Brad King e1a671c7d8 Merge topic 'fix-CMP0046-warning'
d83245a3 cmTarget: Don't create duplicate backtraces in CMP0046 warning
2014-03-13 09:36:06 -04:00
Stephen Kelly d83245a34f cmTarget: Don't create duplicate backtraces in CMP0046 warning 2014-03-12 18:01:26 +01:00
Stephen Kelly f74a8405b6 Test error cases in find_dependency. 2014-03-11 14:48:35 +01:00
Brad King 7b0efcded3 Merge topic 'fix-policy-scopes'
50fd0a33 Tests: Simplify and document policy scopes in RunCMake.CMP* tests
b1bbee3e Record more policies on targets when created
2014-03-10 09:33:25 -04:00
Brad King 50fd0a33c9 Tests: Simplify and document policy scopes in RunCMake.CMP* tests
Drop unnecessary NO_POLICY_SCOPE options.  Document why the remaining
options are necessary.
2014-03-06 11:07:03 -05:00
Brad King b1bbee3e9a Record more policies on targets when created
Policies CMP0027, CMP0038, and CMP0046 have per-target meaning so
record the policy settings on targets as they are created.
2014-03-06 11:05:47 -05:00
Brad King cefa80236d Merge topic 'test-external-cmake'
9608ef6f Tests: Optionally configure tests exclusively, with an external CMake
9f5bd180 Tests: Drop CMAKE_TEST_GENERATOR(|_TOOLSET) variables
76477267 Tests: Drop CMAKE_TEST_MAKEPROGRAM variable
a8a9fb7e Tests: Rename CMAKE_TEST_MAKEPROGRAM uses for explicit make program
40475573 Tests: Rename CMAKE_TEST_MAKEPROGRAM uses for nested test projects
f99734b2 Tests: Rename CMAKE_TEST_DEVENV -> CMake_TEST_DEVENV
3c01ee5a Tests: Drop CMAKE_TEST_MSVC and test MSVC directly
daf0a5fe Tests: Drop CMAKE_TEST_GENERATOR and CMAKE_TEST_MAKEPROGRAM options
e5096312 Tests: Drop kwsys test
2014-03-05 11:07:59 -05:00
Brad King 9f5bd180c8 Tests: Drop CMAKE_TEST_GENERATOR(|_TOOLSET) variables
s/CMAKE_TEST_GENERATOR/CMAKE_GENERATOR/g
2014-03-03 15:26:49 -05:00
Daniele E. Domenichelli 8372b4553b FeatureSummary: Add unit tests 2014-03-03 19:52:13 +01:00
Brad King 7cd239ed38 Tests/RunCMake: Tell cmake not to report unused command-line options
On OS X we pass -DCMAKE_POLICY_DEFAULT_CMP0025=NEW to all tests.
Once tests start using cmake_minimum_required(VERSION 3.0) then
CMake will warn that CMAKE_POLICY_DEFAULT_CMP0025 is unused.
These warnings are not part of the expected test output and can
cause such tests to fail.  Pass --no-warn-unused-cli to each test
cmake invocation to tell it not to produce these warnings.
2014-02-27 13:25:23 -05:00
Brad King 049790c0eb Merge topic 'target-SOURCES-refactor'
f9d5b1fd Handle Mac OSX source flags for individual files lazily.
64d39841 cmGeneratorTarget: Classify sources on demand, not up front.
d3682d86 cmGeneratorTarget: Use a method to access the definition file.
5771f81d cmTarget: Add GetTransitiveTargetClosure method.
a6dd4990 cmTarget: Create a temporary cmTarget in checkInterfacePropertyCompatibility
b8b99cc1 cmTarget: Avoid computing languages when computing transitive targets.
01bca553 cmTarget: Move ComputeLinkInterface to the internal class.
d93e1af2 cmTarget: Extract a ComputeLinkInterfaceLibraries method.
3bcb197c cmTarget: Re-arrange the ComputeLinkInterface method.
326d07d2 cmTarget: Extract a ComputeLinkImplementationLanguages method.
21e91350 cmTarget: Change GetTransitivePropertyLinkLibraries to output targets.
f81eb49e cmTarget: Find source files on request.
84e5f5a0 cmTarget: Move SourceFileFlags to cmGeneratorTarget.
2014-02-25 11:18:12 -05:00
Stephen Kelly 5771f81d91 cmTarget: Add GetTransitiveTargetClosure method.
Replace calls to GetLinkInformation with calls to a method to get only
the target closure, not the link languages etc.  The replaced calls
are used while evaluating generator expressions only.  This makes
transitive generator expression evaluation independent from
the languages of a target.  In a follow-up topic, it will be possible
to make the languages depend on generator expression evaluation, via
evaluation of the SOURCES and INTERFACE_SOURCES target properties.

Because the order of entries is not the same as the final link line,
the order of debug output is different in the RunCMake.CompatibleInterface
test, because the BOOL_PROP7 target property is evaluated first. Adjust
the test to account for that new order.
2014-02-24 16:43:24 +01:00
Ben Boeckel a9bdef2dda tests: Add variable expansion tests
There are some corner cases in variable expansion which would be nice to
capture before going and rewriting the variable expansion code. The
majority of these are related to configuring files and strings with '@'
in them in conjunction with @ONLY being specified. Another is testing
for '(' usage inside of ENV variable references based on whether it is
quoted or not.
2014-02-21 16:39:12 -05:00
Stephen Kelly f2eee72fac add_custom_command: Disallow use of SOURCE signatures.
Add CMP0050 to control this behavior.
2014-02-12 11:19:27 -05:00
Stephen Kelly c248a437c4 Add policy CMP0049 to avoid variable expansion in source lists 2014-02-12 11:17:38 -05:00
Brad King cdcf23bde2 Merge topic 'fix-CMP0028-iface'
b2915238 CMP0028: Trigger on libraries from INTERFACE of dependencies.
2014-02-10 11:25:02 -05:00
Brad King 6e149e1591 Merge topic 'interface-library-signatures'
6d85a6a6 add_library: Issue better diagnostic for INTERFACE GLOBAL signature.
770245e9 add_library: Test invalid GLOBAL INTERFACE signature.
2014-02-10 11:24:54 -05:00
Stephen Kelly b29152387d CMP0028: Trigger on libraries from INTERFACE of dependencies. 2014-02-09 15:35:28 +01:00
Stephen Kelly 6d85a6a64c add_library: Issue better diagnostic for INTERFACE GLOBAL signature. 2014-02-07 15:49:15 +01:00
Stephen Kelly 770245e928 add_library: Test invalid GLOBAL INTERFACE signature.
This has to be tested separately from the invalid_signature test because
target sources are evaluate at a later time, and earlier errors in the
invalid_signature test cause early exit.
2014-02-07 15:49:15 +01:00
Brad King 78be324762 Tests: Speed up RunCMake.CheckModules test
Enable the C and CXX languages only in the test cases that really need
them.  In the failure cases we do not get far enough to really use the
languages, so skip enabling them.
2014-02-06 11:12:50 -05:00
Brad King a7f5a6ee12 Merge topic 'project-version-variables'
41d2f2c4 write_basic_package_version_file: use PROJECT_VERSION
7e142c5a project: Manage VERSION variables
16d040c9 project: Add optional LANGUAGES keyword
00007dcc Help: Format project command and variable documentation
2014-02-03 11:10:58 -05:00
Brad King 7e142c5ac2 project: Manage VERSION variables
Teach the project() command to set variables

  {PROJECT,<PROJECT-NAME>}_VERSION{,_MAJOR,_MINOR,_PATCH,_TWEAK}

holding the project version number and its components.  Add project()
command option "VERSION" to specify the version explicitly, and default
to the empty string when it is not given.

Since this clears variables when no VERSION is given, this may change
behavior for existing projects that set the version variables themselves
prior to calling project().  Add policy CMP0048 for compatibility.

Suggested-by: Alex Neundorf <neundorf@kde.org>
2014-01-29 09:45:18 -05:00
Brad King 16d040c958 project: Add optional LANGUAGES keyword
Teach the project() command to recognize an optional "LANGUAGES"
keyword after the project name and prior to the list of languages.
Do not allow multiple copies of the keyword.  If the keyword is
specified and no languages are listed, imply NONE.
2014-01-29 09:40:51 -05:00
Brad King 5e4b8871bc Cygwin: Avoid legacy warnings in RunCMake.CMP004[1235] tests
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32.  The warning appears on stderr
and breaks the expected output matching.
2014-01-28 17:07:56 -05:00
Brad King 82d4317503 Allow projects to specify extra inputs to CMake
Define a new 'CMAKE_CONFIGURE_DEPENDS' directory property that projects
can use to specify input files to the CMake configuration process.
Extend the RunCMake.Configure test to verify that the build system
re-runs CMake when this input changes.
2014-01-21 14:14:49 -05:00
Brad King 1ef444d678 Add test case to verify CMake does not re-run on first build
Extend the RunCMake.Configure with a case to verify that the CMake
configuration process does not immediately re-run the first time that
the generated build system is invoked.
2014-01-21 13:57:15 -05:00
Brad King 94389f6388 cmake: Add '-E sleep' command
Add a cmake command-line interface to provide a cross-platform 'sleep'.
2014-01-21 13:50:49 -05:00
Brad King e0228e2b04 cmake: Improve '-E create_symlink' edge case handling (#14713)
The logic added by commit ffc0b5e4 (Overwrite the symlink if it already
exists, 2007-02-15) does not recognize and remove existing broken links
before replacing them.  Improve the logic to remove any existing
destination file or link (but not directory).  On failure, report an
error message explaining why the existing path could not be removed or
the new one could not be created.

Add a RunCMake.CommandLine test to cover 'cmake -E' cases.  Start with
test cases covering 'cmake -E create_symlink' behavior on UNIX platforms.
2014-01-20 14:02:21 -05:00
Brad King d4ca30ae15 Tests/RunCMake: Add function to run a specified command-line
Add a 'run_cmake_command' function that can be used by tests to run a
given command-line and check the results rather than always running a
CMake configuration process.  This can be used in the future to test
'cmake -E' for example.
2014-01-20 13:46:51 -05:00
Brad King 392a6553f9 Tests/RunCMake: Move documentation to a README.rst 2014-01-20 13:46:24 -05:00
Nils Gladitz 0bf6f13b1d AddDependencies: new policy requires dependencies to exist
Added new policy CMP0046 which requires dependencies added by
add_dependencies() to actually exist.
2014-01-12 12:58:04 +01:00
Stephen Kelly fcd5531004 Tests: Remove .orig file.
Introduced in commit be0458c5 (InstallRules: added new variable to
disable generation of install rules, 2013-12-25).
2014-01-10 10:29:36 +01:00
Brad King 15562c11ef Merge topic 'policies'
73e9340 get_target_property: Error on non-existent target.
ab9f58f FindQt4: Ensure target exists before calling get_target_property.
37ebeb9 FindQt4: Fix use of get_target_property to use actual target name.
6aabb6a Genex: Use case-sensitive comparison for COMPILER_ID.
5bb53f6 cmTarget: Deprecate COMPILE_DEFINITIONS_ properties with a policy.
2014-01-09 09:37:20 -05:00
Brad King 69c366a281 Merge topic 'optional-install'
be0458c InstallRules: added new variable to disable generation of install rules
2014-01-09 09:37:17 -05:00
Stephen Kelly 73e93400e2 get_target_property: Error on non-existent target.
Introduce policy CMP0045 to control this behavior.
2014-01-08 16:41:34 +01:00
Stephen Kelly 6aabb6a62b Genex: Use case-sensitive comparison for COMPILER_ID. 2014-01-08 16:41:34 +01:00
Stephen Kelly 5bb53f6b73 cmTarget: Deprecate COMPILE_DEFINITIONS_ properties with a policy. 2014-01-08 16:41:34 +01:00
Nils Gladitz be0458c562 InstallRules: added new variable to disable generation of install rules
The boolean variable CMAKE_SKIP_INSTALL_RULES
allows disabling generation of install rules for projects which don't
want them.
2014-01-08 16:28:14 +01:00
Stephen Kelly 5d1fc198b7 Help: Ensure that target-policies are added to the documentation.
The two most-recently-added policies were not tested for.
2014-01-07 16:05:15 +01:00
Stephen Kelly 3917d86b26 Genex: Add a nullary form for CONFIG
This is consistent with other similar expressions such as PLATFORM_ID,
and makes the CONFIGURATION expression obsolete.

Fix an off-by-one error in
GeneratorExpressionContent::EvaluateParameters exposed by a unit test.

Remove the test for 'bad' nullary use of $<CONFIG>.

Add a unit test to verify that $<CONFIG> and $<CONFIGURATION> have
the same value.
2014-01-07 09:38:01 -05:00
Stephen Kelly ee21f1c605 CompatibleInterface: Test debugging of not-set property. 2014-01-07 09:38:01 -05:00
Stephen Kelly 28c865bb22 Tests: simplify Qt4 target usage
This content was copied from another test where both the Core and Gui
targets are used.
2014-01-07 09:38:00 -05:00
Stephen Kelly 84fac67f90 Don't allow include() of export(EXPORT) file at configure time.
As a new feature it does not need to participate in CMP0024.

Store cmExportBuildFileGenerator instances which correspond to the
export(EXPORT) signature in a second map which does not own the
pointers.  This avoids the need to add cmExportBuildFileGenerator
and dependencies to the bootstrap system.
2014-01-06 17:25:11 +01:00
Stephen Kelly 9eb06d0dde add_library: Disallow invalid signatures for INTERFACE_LIBRARY.
Document the valid signatures. Add a test for the IMPORTED GLOBAL
signature.
2014-01-06 17:25:10 +01:00
Stephen Kelly c9f9b3cd94 cmTarget: Test impliedByUse number-compatible properties.
Test that it is an error to read a number-compatible property to
determine the link implementation.  An alternative would be to
consider the value to be "0", however, that is too arbitrary
given the use-cases of this feature.  Values from this feature may
be used in setting a define, where "0" may have special or invalid
meaning and should be explicit.
2014-01-04 11:28:58 +01:00
Stephen Kelly fbe1fa722f cmTarget: Don't repeat property origin debug information. 2014-01-04 11:28:58 +01:00
Stephen Kelly 01c545c596 cmTarget: Fix debug report for interface-set compatibility types.
If the dependent target sets the property to boolean false, ensure
that that appears in the debug report.  Previously, the report
output contained whether the property was consistent among dependencies,
displaying 'TRUE', instead of the content of the property, which may
be 'FALSE'.

Return a std::pair from the consistentProperty method.  This makes
it possible to make the return value for string types easier to
reason about.  The return value of consistentProperty was previously
set to an empty static string to emulate a 'true' value for the caller
in commit 816b4a8a (cmTarget: Make consistentProperty
return consistent content., 2013-10-22).  The pair makes the
consistency result properly typed.
2014-01-04 11:28:58 +01:00
Stephen Kelly c67e1a6aac cmTarget: Fix reporting interface-set properties which are FALSE. 2014-01-04 11:28:58 +01:00
Stephen Kelly 79db8ef78d cmTarget: Fix the property compatibility error message
Don't refer to 'both', but a 'mixture'. List all compatible interface
property types possible.

Add another test for a mixture of three compatibilities.
2014-01-04 11:28:57 +01:00
Stephen Kelly 6db7e6d24c add_dependencies: Disallow use with INTERFACE_LIBRARY. 2014-01-04 11:28:56 +01:00
Brad King 6cff2afc8b Merge topic 'export-EXPORT-subcommand'
98b9f52 Help: Document export(EXPORT) in the cmake-packages manual.
a1d2bda Don't copy find_dependency in configure_package_config_file.
f4f6529 Help: cmake-packages: Add missing slash.
cbe7e8f export: Implement EXPORT subcommand (#9822)
2014-01-02 14:44:08 -05:00
Brad King 0d63bdd2d9 Merge topic 'rpath-default'
d25ad48 OS X: Add CMP0042 to enable MACOSX_RPATH by default
2014-01-02 14:23:09 -05:00
Clinton Stimpson d25ad482e9 OS X: Add CMP0042 to enable MACOSX_RPATH by default
Also adding documentation for CMAKE_MACOSX_RPATH, and improving
documentation for MACOSX_RPATH.
2014-01-02 13:41:49 -05:00
Stephen Kelly cbe7e8fae4 export: Implement EXPORT subcommand (#9822)
Teach the export command to handle export sets defined by invocations
of install(TARGETS ... EXPORT foo).  This makes maintenance of targets
exported to both the build tree and install tree trivial.
2013-12-24 13:02:49 +01:00
Stephen Kelly cad5c79e6c cmTarget: Fix typo
'a ALIAS' -> 'an ALIAS'
2013-12-19 16:17:59 +01:00
Stephen Kelly 3b8e56a50f Don't search for IMPORTED_LOCATION of INTERFACE_LIBRARY (14636)
The INTERFACE_LIBRARY type does not have any LOCATION at all, so
return early from GetMappedConfig. GetMappedConfig is called from
two locations, one of which already pre-checks the INTERFACE_LIBRARY
case. Remove that pre-check and handle that case inside the method
instead.
2013-12-09 20:52:52 +01:00
Stephen Kelly 77f3772784 cmTarget: Require a compatible INTERFACE_AUTOUIC_OPTIONS from dependencies.
Revert the origin-tracking infrastructure from commit 98093c45 (QtAutoUic:
Add INTERFACE_AUTOUIC_OPTIONS target property., 2013-11-20). Use the
compatibility-tracking for compatible strings instead.

If two different dependencies require different AUTOUIC_OPTIONS,
cmake will now appropriately issue an error.
2013-12-08 07:03:29 +01:00
Stephen Kelly 2e60b5fcf7 cmTarget: Report origin of COMPATIBLE_INTERFACE properties. 2013-12-08 07:03:29 +01:00
Brad King a5c3f059ff Merge topic 'fix-export-segfault'
1cd1430 export(): Check targets exist at configure-time (#14608)
2013-12-04 08:33:36 -05:00
Stephen Kelly 1cd1430b1f export(): Check targets exist at configure-time (#14608)
Commit 66b290e7 (export(): Process the export() command at generate
time., 2012-10-06 ) refactored export() so that it could evaluate
strings at generate-time. This was intended for evaluating target
properties, but that commit also removed a check for target
existence at configure-time. Restore that check and add a test for
this case.
2013-12-04 08:30:26 -05:00
Brad King 9d51c764f7 Merge topic 'export-includes'
5838aba Export: Report error on relative include with genex.
7a3e45b Export: Prefix relative items with genexes in INSTALL_INTERFACE.
f088a32 Export: Process INSTALL_INTERFACE in INCLUDES DESTINATION.
9eedc85 Export: Process relative includes after genex evaluation.
80790f3 Export: Test existing behavior of exporting includes with genexes.
38afc82 target_include_directories: Allow relative path with genex
2013-12-02 12:06:43 -05:00
Stephen Kelly 5838aba1aa Export: Report error on relative include with genex.
Diagnostics which check the sanity of exported include paths
previously skipped over any path containing a generator expression.

Introduce a policy to issue an error message in such cases.

The export files created in the OLD behavior are not usable, because
they contain relative paths or paths to the source or build location
which are not suitable for use on installation. CMake will report an
error on import.
2013-11-26 13:01:55 +01:00
Stephen Kelly 9eedc850eb Export: Process relative includes after genex evaluation.
In code such as

 install(TARGETS ...
   INCLUDES DESTINATION $<FOO>include
 )

the generator expressions are evaluated at generate-time. Delay
determining whether each entry is a relative path until after
the generator expressions are evaluated. Such relative paths
are based relative to the CMAKE_INSTALL_PREFIX.
2013-11-26 13:01:29 +01:00
Stephen Kelly 80790f3311 Export: Test existing behavior of exporting includes with genexes.
Test that no warning or error diagnostic is issued for 'good code'.
2013-11-26 13:00:43 +01:00
Stephen Kelly 5ee9e6bc11 cmTarget: Add whitelist of properties on INTERFACE_LIBRARY. 2013-11-25 16:23:11 +01:00
Nils Gladitz a02f3d2de0 Add policy CMP0040 to disallow custom commands on missing targets 2013-11-21 09:24:08 -05:00
Brad King 1da77bf1ee Merge topic 'cleanup-build-commands'
4cce44b Help: Document the CMAKE_MAKE_PROGRAM variable in more detail
558c74d VS: Switch to internal CMAKE_MAKE_PROGRAM lookup by generators
5229f2d Tests: Do not use an explicit make program for VS generators
72dd738 Tests: Fix MFC test heuristic for empty CMAKE_TEST_MAKEPROGRAM
fd6076d Tests: Pass CMAKE_MAKE_PROGRAM instead of --build-makeprogram
68031ab Tests: Configure SubProject-Stage2 test more robustly
003d10c Tests: Simplify VSExcludeFromDefaultBuild configuration
e47d934 Tests: Simplify VSProjectInSubdir configuration
e965cb1 Tests: Simplify CTest.BuildCommand.ProjectInSubdir configuration
72bf255 Tests: Pass --build-options to every test
4d1d772 ctest: Teach --build-options to allow zero options
96966b5 ctest: Make the --build-makeprogram optional for --build-and-test
91a0211 Simplify some calls to cmGlobalGenerator::Build
123a060 Teach GenerateBuildCommand to find its own make program
5f5c92b VS: Add internal APIs to find MSBuild, devenv/VCExpress, and msdev
4ac75fd Prefer CMAKE_MAKE_PROGRAM over CMAKE_BUILD_TOOL (#14548)
...
2013-11-19 10:55:39 -05:00
Nils Gladitz 3900fcf4a8 CMP0037: Extend policy to reserved names and custom targets
Teach add_custom_target to check the policy too.  Extend the policy to
disallow reserved target names that we use for builtin targets like
"all".

Extend the RunCMake.CMP0037 test to cover these cases.
2013-11-19 09:44:22 -05:00
Brad King 4ac75fdfe6 Prefer CMAKE_MAKE_PROGRAM over CMAKE_BUILD_TOOL (#14548)
Historically these were both added for the Makefile and Visual Studio
generators, respectively.  Later the VS generators started using the
CMAKE_MAKE_PROGRAM cache entry to find the IDE build tool, and the
CMAKE_BUILD_TOOL was simply set as an alias.

Fix the documentation to explain that CMAKE_MAKE_PROGRAM is the modern
variable and that CMAKE_BUILD_TOOL is the compatibility alias, not the
other way around.  Replace uses of CMAKE_BUILD_TOOL with
CMAKE_MAKE_PROGRAM in CMake-provided modules.  Nothing needs to lookup
CMAKE_BUILD_TOOL in the cache, so simply set it as a normal variable.
2013-11-18 08:26:23 -05:00
Brad King bca67c710f build_command: Return a "cmake --build" command-line
Re-implement the build_command() command to use "cmake --build" instead
of generating a native build tool invocation directly.  This command
will internally invoke the proper native build tool.

This avoids requiring cmGlobalGenerator::GenerateBuildCommand to produce
a string so that it can be later refactored to produce a vector with no
quoting or escaping.  It will also allow us to later teach CMake to
delay the decision about which build tool to invoke until after the
project build system is generated to disk.  For example, on Visual
Studio 10 and above the preferred command-line tool is MSBuild, but we
need to fall back to devenv if the .sln has Intel Fortran .vfproj files.
2013-11-15 14:38:18 -05:00
Brad King 15872a3c30 Merge topic 'set_emptyvar_PARENT_SCOPE'
bf755c7 set: Add unit tests for set/unset PARENT_SCOPE
bc280f1 set: Fix handling of empty value with PARENT_SCOPE
20afbd5 set: Handle value-less PARENT_SCOPE explicitly
2013-11-14 11:28:12 -05:00
Brad King 42eaf34168 Merge topic 'configure_file-drop-IMMEDIATE'
15610bb Drop use of configure_file IMMEDIATE option
2013-11-14 11:28:07 -05:00
Daniele E. Domenichelli bf755c7c38 set: Add unit tests for set/unset PARENT_SCOPE
Create a RunCMake.set test to cover set() command cases, starting with
PARENT_SCOPE.
2013-11-13 10:18:38 -05:00
Daniele E. Domenichelli 15610bb5b1 Drop use of configure_file IMMEDIATE option
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
2013-11-13 10:12:17 -05:00
Brad King 8eb20eeabe ExternalData: Allow local stores without any URL templates
Allow ExternalData_URL_TEMPLATES to be empty if a value for
ExternalData_OBJECT_STORES is provided.  Assume in this use case that
the object stores will already contain all needed objects.  Extend the
Module.ExternalData test to cover this case (all objects in stores).
Extend the RunCMake.ExternalData test to cover the non-failure message
case when stores are provided without URL templates.
2013-11-13 10:03:36 -05:00
Brad King 978d796e8d Merge topic 'policy-summary-periods'
49cbca6 CMP0038: Add missing '.' to policy summary line
7390002 CMP0039: Add missing '.' to policy summary line
2013-11-13 09:58:50 -05:00
Brad King 3c4071bec4 Merge topic 'fix-INTERFACE-with-no-SHARED-libs'
64f73b0 add_library: Fix INTERFACE on platforms with no shared libs (#14561)
2013-11-13 09:57:20 -05:00
Daniele E. Domenichelli 7390002964 CMP0039: Add missing '.' to policy summary line 2013-11-12 11:54:14 -05:00
Stephen Kelly 64f73b0fb6 add_library: Fix INTERFACE on platforms with no shared libs (#14561) 2013-11-12 09:07:10 -05:00
Brad King 298ef43329 Merge topic 'test-RunCMake.CMP0037-everywhere'
8c6c1f1 Enable RunCMake.CMP0037 test everywhere
2013-11-12 08:31:48 -05:00
Brad King 8c6c1f16c9 Enable RunCMake.CMP0037 test everywhere
Split the test cases covering spaces and colons into separate units.
Run the space cases everywhere.  Disable the colon cases where they
are known to fail.  This approach increases platform coverage for the
test and makes the known-failure logic as local as possible.

No Makefile generator on Windows can generate targets with ':'
in their name because the CMakeFiles/<target>.dir directory cannot
be created.  Skip this part of the test on all Windows Make tools.
2013-11-11 07:27:02 -05:00
Brad King 110f244601 Merge topic 'test-LINK_ONLY-expression'
53b10fd Genex: Add a test for the LINK_ONLY expression.
2013-11-08 10:33:18 -05:00
Stephen Kelly 596b2a8c08 Disallow linking to utility targets (#13902). 2013-11-07 11:06:40 +01:00
Stephen Kelly 301bb5cdda Disallow link-to-self (#13947). 2013-11-07 11:06:39 +01:00
Stephen Kelly 05f5fde0eb Disallow invalid target names (#13140)
Exclude Borland and NMake from the CMP0037 test. They do not accept
the colon in a target name.
2013-11-07 11:06:39 +01:00
Stephen Kelly 53b10fdad7 Genex: Add a test for the LINK_ONLY expression.
Commit 239b0c6b (Don't add invalid content to static lib
INTERFACE_LINK_LIBRARIES., 2013-10-20) extended a test which
excercised the logic of the LINK_ONLY generator expression.

Commit ef10b87c (CMP0022: Plain target_link_libraries must populate
link interface, 2013-11-02) removed the instance of LINK_ONLY which
was excercised by that test.

Add a new test which excercises the other instance of LINK_ONLY by
setting the CMP0022 policy to NEW and consuming the contents of the
INTERFACE_LINK_LIBRARIES target property.
2013-11-06 22:57:31 +01:00
Brad King 25b7f87eca Merge branch 'policy-CMP0022-fixes' into policy-CMP0022-fixes-for-master
Resolve conflict in Source/cmTarget.cxx by integrating the changes to
the internal copy constructor from both sides.  Also resolve a logical
conflict by dropping the special case for INTERFACE_LIBRARY targets.
Since cmTarget::SetMakefile already forces CMP0022 to NEW for such
targets we need no special handling.

Resolve conflict in Source/cmTargetLinkLibrariesCommand.h by dropping
the documentation change.  We will make the same change in the new
location of the same documentation in a separate commit.

Resolve conflicts in

 Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt
 Tests/RunCMake/CMP0022/RunCMakeTest.cmake

by taking the side from the 'policy-CMP0022-fixes' branch.
2013-11-03 09:20:47 -05:00
Brad King 0a561a0347 CMP0022: Warn about a given target at most once
Since cmTarget::ComputeLinkInterface is called separately for each
"head" target that links a target, the warning we produce when
CMP0022 is not set could be repeated.  Add explicit logic to allow
the warning to appear at most once.  Multiple copies of the warning
for the same target are almost always identical and therefore
redundant.  In the rare case that two copies of the warning are
different, the second can appear in a future run after the first
is fixed.
2013-11-03 09:14:54 -05:00
Brad King 23d21b78e1 Do not export INTERFACE_LINK_LIBRARIES from non-linkable targets
When cmExportFileGenerator::SetImportLinkInterface exports the old
LINK_INTERFACE_LIBRARIES property values it skips doing so for
non-linkable targets because target->GetLinkInterface returns NULL for
such targets.

Since cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty
looks at the INTERFACE_LINK_LIBRARIES property directly instead of using
the computed link interface, teach it to skip exporting the property if
target->IsLinkable returns false.

Extend the RunCMake.CMP0022 test with a case covering this.  Simply
export an executable target that links to a library that is not
exported.
2013-11-02 14:51:07 -04:00
Brad King ef10b87cc1 CMP0022: Plain target_link_libraries must populate link interface
The CMP0022 NEW behavior is that the INTERFACE_LINK_LIBRARIES property
exactly defines the link interface.  The plain target_link_libraries
signature says linking is transitive by default, so it should populate
the property.

Teach the target_link_libraries plain signature to populate the
INTERFACE_LINK_LIBRARIES regardless of the CMP0022 setting.  Refactor
the cmTarget::ComputeLinkInterface checks that warn when the policy is
not set to compare the new property to either the explicitly set old
link interface properties or the link implementation fallback for all
linkable target types, not just static libraries.

This fixes a regression in 2.8.12.0 that caused target_link_libraries to
not implement transitive linking in the plain signature once the policy
CMP0022 is set to NEW.
2013-11-02 12:55:17 -04:00
Stephen Kelly c0f4a61074 CMP0022: Add unit test for null pointer check and message. 2013-11-02 12:48:40 -04:00
Brad King 4b0cfa7004 Merge branch 'output-CMP0022-entries' into policy-CMP0022-fixes 2013-11-02 12:47:45 -04:00
Brad King 872a9d6476 Merge topic 'object-library-no-TARGET_FILE'
d960589 Genex: Reject $<TARGET_FILE:...> for object libraries (#14532)
2013-11-02 10:54:23 -04:00
Brad King 53ac9b8d86 Merge topic 'object-library-missing-source'
5a2fc3d Check for OBJECT_LIBRARY source files at start of generation
2013-11-02 10:54:15 -04:00
Brad King 5a2fc3d696 Check for OBJECT_LIBRARY source files at start of generation
Teach cmGlobalGenerator::CheckTargets to include OBJECT_LIBRARY targets
in the check for source file existence.

Extend the RunCMake.ObjectLibrary test to cover this case.
2013-11-01 14:46:58 -04:00
Brad King d960589778 Genex: Reject $<TARGET_FILE:...> for object libraries (#14532)
Teach the cmGeneratorExpressionEvaluator filesystem artifact logic
to reject OBJECT_LIBRARY targets since they have no main artifact.
Without the explicit rejection evaluation falls through to an
internal CMake error message in cmTarget::GetOutputInfo.

Extend the RunCMake.GeneratorExpression test to cover these cases.
2013-11-01 10:17:01 -04:00
Brad King e065decd43 Merge topic 'add-CMAKE_FIND_NO_INSTALL_PREFIX'
fe057ab Allow disabling adding the install prefix to the prefix search path.
2013-11-01 09:40:19 -04:00
Stephen Kelly fe057ab3cd Allow disabling adding the install prefix to the prefix search path.
In certain scenarios, it is preferable to keep a 'dirty' install prefix
than to clear it, and to expect that content will not be found there.
Add a CMAKE_FIND_NO_INSTALL_PREFIX variable that can be set to disable
searching the install prefix.
2013-10-31 16:40:24 +01:00
Brad King b54dbebf62 Test foreach/function/macro handling of bracket arguments
Bracket arguments recorded in command invocations inside foreach,
function, and macro blocks should not have any replacements done when
the arguments are replayed later.  Teach the RunCMake.Syntax test to
cover these cases.
2013-10-30 19:13:41 -04:00
Brad King 8640e52979 Add to RunCMake.Syntax test \-escape cases
Add an Escape1 test case covering \-escape cases inside bracket, quoted,
and unquoted arguments.  Also cover comments immediately after quoted
and unquoted arguments on lines containing \# escapes.
2013-10-29 10:21:50 -04:00
Brad King 144068e270 Add to RunCMake.Syntax test comments not separated by spaces
Extend the BracketComment5 test case to cover both bracket comments and
line comments starting immediately after a bracket comment closes.
2013-10-29 09:55:43 -04:00
Brad King 16df2456a4 Merge topic 'enable-language-require-compiler'
3e04946 Require CMAKE_<LANG>_COMPILER to be found as a full path
6007f7c CMakeDetermineCompilerId: Always use compiler detected from IDE
332771c CMakeDetermine*Compiler: Remove temporary cache entry
2013-10-28 08:39:29 -04:00
Brad King 3e04946f7b Require CMAKE_<LANG>_COMPILER to be found as a full path
All generators now support detection of the full path to the compiler, so
require it to be so.  This will allow CMake<LANG>Information.cmake and
other logic to assume the full path to the compiler tool is available.

The Makefile generators already rejected CMAKE_<LANG>_COMPILER values
that did not name an existing compiler.  Extend this error message to
all generators, make it occur as early as possible, and improve the
message with advice about how to set the compiler.  If the full path to
the compiler is not known, finish enabling languages with a fatal error
so configuration does not continue.

For now, allow the RC language compiler to not be a full path.  Later we
will need to detect the full path to "rc" under the VS IDE.

Add a RunCMake.CompilerNotFound test to cover failure cases.
Fix the RunCMake.CompilerChange test EmptyCompiler case to work
when configuration does not continue past enable_language.
2013-10-28 08:36:14 -04:00
Brad King bd48b8a8ce Merge topic 'handle-CMP0024-in-tests'
310aef9 Make ExportLanguages a subtest of the ObjectLibrary test
30ff6cf Refactor the Plugin test.
2013-10-26 10:28:55 -04:00
Brad King bb21e17fb7 Merge topic 'remove-pre-2.4-compatibility'
7d47c69 Drop compatibility with CMake < 2.4
c7c44fc CTestTest*: Update minimum required CMake to 2.4
2013-10-26 10:28:09 -04:00
Brad King 1b21ac405f Merge topic 'fix-tll-static-private'
239b0c6 Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.
2013-10-26 10:28:02 -04:00
Brad King 0c46e55656 Merge topic 'remove-old-commands-by-policy'
4ea27bc Cygwin: Avoid legacy warnings in RunCMake.DisallowedCommands test
2013-10-26 10:27:49 -04:00
Stephen Kelly 239b0c6b0e Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.
Only valid target names or generator expressions may appear in
the target field of a LINK_ONLY expression.

Other content like link flags should still be added to that property
(wrapped in config-specific generator expressions), but not wrapped
in LINK_ONLY. Otherwise undue warnings would be issued for the
policy CMP0022.

The LINK_ONLY expression only has an effect for actual target
names anyway, so there is no logical deficit.
2013-10-26 10:10:20 -04:00
Brad King 4ea27bcc4c Cygwin: Avoid legacy warnings in RunCMake.DisallowedCommands test
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32.  The warning appears on stderr
and breaks the expected output matching.
2013-10-25 15:07:35 -04:00
Stephen Kelly 310aef959b Make ExportLanguages a subtest of the ObjectLibrary test
It was a subtest of the RunCMake.ObjectLibrary test. However, we need
to test a build with ExternalProject after running CMake, which RunCMake tests
do not do.
2013-10-24 19:05:34 +02:00
Brad King efcf318f8d Add \-continuation to CMake language quoted arguments
Teach the CMake language lexer to treat the \-LF pair terminating a
line ending in an odd number of backslashes inside a quoted argument
as a continuation.  Drop the pair from the returned quoted argument
token text.  This will allow long lines inside quoted argument
strings to be divided across multiple lines in the source file.
It will also allow quoted argument text to start on the line after
the opening quote.  For example, the code:

 set(x "\
 ...")

sets variable "x" to the value "..." with no opening newline.

Previously an odd number of backslashes at the end of a line inside
a quoted argument would put a \-LF pair (or a \-CR pair) literally
in the argument.  Then the command-argument evaluator would complain
that the \-escape sequence is invalid.  Therefore this syntax is
available to use without changing behavior of valid existing code.

Teach the RunCMake.Syntax test to cover cases of quoted arguments
with lines ending in \, \\, and \\\.  Odd counts are continuations.
2013-10-23 09:02:07 -04:00
Brad King 7d47c69365 Drop compatibility with CMake < 2.4
Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to
a value lower than 2.4, and generate an error when projects or the user
attempt to do so.  In the error suggest using a CMake 2.8.x release.

Teach cmake_minimum_required to warn about projects that do not require
at least CMake 2.4.  They are not supported by CMake >= 3.0.

Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a
reference to policy CMP0001.
2013-10-23 08:54:31 -04:00
Brad King d67286ff9b Merge topic 'output-CMP0022-entries'
0b3b336 CMP0022: Output link interface mismatch for static library warning
2013-10-23 08:20:14 -04:00
Brad King 8855bf5395 Merge topic 'remove-old-commands-by-policy'
6c91944 Add policy CMP0036 to disallow build_name
3969bb2 Add policy CMP0035 to disallow variable_requires
178b9af Add policy CMP0034 to disallow utility_source
248d1dc Add policy CMP0033 to disallow export_library_dependencies
6865c8f Add policy CMP0032 to disallow output_required_files
aa76518 Add policy CMP0031 to disallow load_command
97268cf Add policy CMP0030 to disallow use_mangled_mesa
9f64fbf Add policy CMP0029 to disallow subdir_depends
882c0f0 Add infrastructure for policies that disallow commands
2013-10-23 08:19:57 -04:00
Brad King 6403a53f0e Merge topic 'CheckTypeSize_CXX'
e6cec64 CheckTypeSize: Add unit tests
07a2342 CheckTypeSize: Add support for C++
2013-10-23 08:19:46 -04:00
Stephen Kelly 0b3b3368fb CMP0022: Output link interface mismatch for static library warning
Other warnings for the same policy already have similar output since
commit 81d2793e (Add differing target property content to policy CMP0022
warning, 2013-09-11).
2013-10-23 08:18:02 -04:00
Brad King 6c9194488a Add policy CMP0036 to disallow build_name 2013-10-22 09:09:53 -04:00
Brad King 3969bb23aa Add policy CMP0035 to disallow variable_requires 2013-10-22 09:09:52 -04:00
Brad King 178b9af186 Add policy CMP0034 to disallow utility_source 2013-10-22 09:09:52 -04:00
Brad King 248d1dc057 Add policy CMP0033 to disallow export_library_dependencies 2013-10-22 09:09:52 -04:00
Brad King 6865c8fe05 Add policy CMP0032 to disallow output_required_files 2013-10-22 09:09:52 -04:00
Brad King aa76518f8b Add policy CMP0031 to disallow load_command 2013-10-22 09:09:52 -04:00
Brad King 97268cf5b7 Add policy CMP0030 to disallow use_mangled_mesa 2013-10-22 09:09:51 -04:00
Brad King 9f64fbf5b5 Add policy CMP0029 to disallow subdir_depends 2013-10-22 09:09:51 -04:00
Brad King 882c0f0b69 Add infrastructure for policies that disallow commands
Add cmCommand::Disallowed helper to check the setting of a policy that
disallows the command.  Add a RunCMake.DisallowedCommands test
placeholder.  Add a Help/policy/DISALLOWED_COMMAND.txt file for
inclusion by each policy document to avoid duplication of the common
text.
2013-10-22 09:09:51 -04:00
Brad King 7809adb814 Merge topic 'string-CONCAT-command'
4e184a2 string: Add CONCAT sub-command
2013-10-22 09:08:15 -04:00
Brad King 0d9e8b1ab9 Merge topic 'double-colon-is-imported'
f063c45 Consider targets with double colons to be IMPORTED or ALIAS targets.
2013-10-22 09:07:40 -04:00
Brad King 4e184a21be string: Add CONCAT sub-command
Add a string(CONCAT) command to simply concatenate input arguments
together.  This will be useful for combining strings from different
quoting syntaxes.  Add a RunCMake.string test covering these cases.
2013-10-21 12:54:20 -04:00
Daniele E. Domenichelli e6cec64820 CheckTypeSize: Add unit tests 2013-10-21 16:39:04 +02:00
Stephen Kelly f063c45589 Consider targets with double colons to be IMPORTED or ALIAS targets.
Introduce a policy to control the behavior.

The AliasTargets unit test already tests that using a
double-semicolon in the name is not an error. Change the ExportImport
test to use a namespace with a double-semicolon too.
2013-10-21 15:56:31 +02:00
Brad King 9fb65d7090 Merge topic 'cmake-syntax-updates'
daa0f6f Add Lua-style long brackets and long comments to CMake language
a8c6523 cmListFileLexer: Convert CRLF -> LF newlines explicitly
dbd9333 cmListFileLexer: Allow a leading UTF-8 Byte-Order-Mark (#11137)
5645783 cmListFileLexer: Allow command names with one letter (#14181)
2013-10-21 09:02:00 -04:00
Brad King 936dec32e5 Merge topic 'target-LOCATION-policy'
abfebef Cygwin: Avoid legacy warnings in RunCMake.CMP0026 test
2013-10-20 07:37:48 -04:00
Brad King abfebefbb9 Cygwin: Avoid legacy warnings in RunCMake.CMP0026 test
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32.  The warning appears on stderr
and breaks the expected output matching.
2013-10-19 06:47:12 -04:00
Stephen Kelly 70ae6dfd92 Handle genexes when evaluating INTERFACE_INCLUDE_DIRECTORIES errors. 2013-10-18 10:11:49 -04:00
Brad King daa0f6f98d Add Lua-style long brackets and long comments to CMake language
Teach the CMake language parser to recognize Lua-style "long bracket"
arguments.  These start with two '[' separated by zero or more '='
characters e.g. "[[" or "[=[" or "[==[".  They end with two ']'
separated by the same number of '=' as the opening bracket.  There is no
nesting of brackets of the same level (number of '=').  No escapes,
variable expansion, or other processing is performed on the content
between such brackets so they always represent exactly one argument.

Also teach CMake to parse and ignore "long comment" syntax.  A long
comment starts with "#" immediately followed by an opening long bracket.
It ends at the matching close long bracket.

Teach the RunCMake.Syntax test to cover long bracket and long comment
cases.
2013-10-17 09:07:00 -04:00
Brad King a8c652342f cmListFileLexer: Convert CRLF -> LF newlines explicitly
Read input files in binary mode instead of text mode and convert CRLF
newlines to LF newlines explicitly in our own buffer.  This is necessary
to read CMake source files with CRLF newlines on platforms whose C
runtime libraries do not transform newlines in text mode.  For example,
a Cygwin or Linux binary may not transform CRLF -> LF in files read from
a Windows filesystem.  Perform the conversion ourselves to ensure that
multi-line string literals in CMake source files have LF newlines
everywhere.
2013-10-17 09:07:00 -04:00
Brad King dbd933365e cmListFileLexer: Allow a leading UTF-8 Byte-Order-Mark (#11137)
Teach the lexer to read a UTF-8, UTF-16 BE/LE, or UTF-32 BE/LE
Byte-Order-Mark from the start of a file if any is present.  Report an
error on files using UTF-16 or UTF-32 and accept a UTF-8 or missing BOM.
2013-10-17 09:06:59 -04:00
Brad King 56457837e2 cmListFileLexer: Allow command names with one letter (#14181)
Teach the lexer to treat a single letter as an identifier instead of an
unquoted argument.  Outside of a command invocation, the parser treats
an identifier as a command name and an unquoted argument as an error.
Inside of a command invocation, the parser treats an identifier as an
unquoted argument.  Therefore this change to the lexer will make what
was previously an error case work with no other behavioral change.
2013-10-17 09:06:59 -04:00
Stephen Kelly 4fd60241c8 CMP0022: Add unit test for null pointer check and message. 2013-10-16 10:45:55 -04:00
Brad King b31ca93ba2 Merge topic 'target-LOCATION-policy'
e4e5b28 cmTarget: Deprecate the LOCATION target property with a policy.
2013-10-15 09:33:05 -04:00
Stephen Kelly e4e5b28c27 cmTarget: Deprecate the LOCATION target property with a policy.
The final location and name of a build-target is not determined
until generate-time. However, reading the LOCATION property from
a target is currently allowed at configure time. Apart from creating
possibly-erroneous results, this has an impact on the implementation
of cmake itself, and prevents some major cleanups from being made.

Disallow reading LOCATION from build-targets with a policy. Port some
existing uses of it in CMake itself to use the TARGET_FILE generator
expression.
2013-10-11 21:17:27 +02:00
Stephen Kelly 66b290e7e2 export(): Process the export() command at generate time.
Make the API for adding targets string based so that it can easily
use cmGeneratorTarget.

Teach the cmIncludeCommand to generate the exported file at
configure-time instead if it is to be include()d.

The RunCMake.ExportWithoutLanguage test now needs a dummy header.h
file as expected error from export() is now reported after the
missing file error.
2013-10-11 12:46:10 +02:00
Stephen Kelly af1f698757 CMP0024: Store the fact of included export in global generator.
Storing it in the makefile means that the policy does not trigger
when include and export are in differing directories.
2013-10-10 12:01:39 +02:00
Brad King be9d289fce Merge topic 'deprecation-message'
f973737 GenerateExportHeader: Port to use message(DEPRECATION)
f69606d Qt4Macros: Port to use message(DEPRECATION)
509c142 message: Add a DEPRECATION mode
2013-10-09 10:24:16 -04:00
Brad King 12a7e2b10c Merge topic 'apple-clang-id'
1763c31 Set policy CMP0025 to NEW while building CMake itself
aa53ee5 Add policy CMP0025 for Apple Clang compiler id compatibility
ab65862 Clang: Add separate "AppleClang" compiler id
2013-10-09 10:21:28 -04:00
Stephen Kelly f69606d335 Qt4Macros: Port to use message(DEPRECATION) 2013-10-08 18:23:42 +02:00
Stephen Kelly 509c142a3f message: Add a DEPRECATION mode
By default, the message is not issued. If CMAKE_ERROR_DEPRECATED
is on, the message is fatal. If CMAKE_WARN_DEPRECATED is on, the
message is a warning.
2013-10-08 18:11:22 +02:00
Brad King 40c84683aa Merge topic 'export-policy'
904ff9f export: Add policy CMP0024 to disallow include() of export files
2013-10-08 10:59:07 -04:00
Brad King f8241136b4 Merge topic 'INTERFACE_LIBRARY-target-type'
ce0c303 install: Teach EXPORT option to handle INTERFACE_LIBRARY targets
435c912 export: Add support for INTERFACE_LIBRARY targets
fe73226 Add the INTERFACE_LIBRARY target type.
2013-10-08 10:58:40 -04:00
Brad King 4340507207 Merge topic 'CheckStructHasMember_CXX'
73d28d2 CheckStructHasMember: Add support for C++
2013-10-08 09:53:37 -04:00
Daniele E. Domenichelli 73d28d2177 CheckStructHasMember: Add support for C++
Previously if headers required to check if a struct has a member can be
compiled with C++ compiler only, the check would fail because the C
compiler fails.  As a consequence, the result variable would be set to
false, even if the struct has that particular member.

Teach CHECK_STRUCT_HAS_MEMBER to accept a new optional argument LANGUAGE
that allows one to explicitly set the compiler to use.  The new
signature is therefore:

  CHECK_STRUCT_HAS_MEMBER (<struct> <member> <header> <variable>
                           [LANGUAGE <language>])
2013-10-08 09:43:06 -04:00
Brad King 1763c31c3b Set policy CMP0025 to NEW while building CMake itself
CMake is aware of the policy's NEW behavior and the AppleClang compiler
id.  Set the policy to NEW explicitly to avoid the warning and get the
NEW behavior.

Also teach the RunCMake test infrastructure to build tests with
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW to avoid the policy warning
in test output that must match specific regular expressions.
2013-10-07 20:12:46 -04:00
Stephen Kelly 435c912848 export: Add support for INTERFACE_LIBRARY targets 2013-10-07 20:07:27 -04:00
Stephen Kelly 904ff9fe59 export: Add policy CMP0024 to disallow include() of export files
Currently, export() is executed at configure-time.

One problem with this is that certain exported properties like
the link interface may not be complete at the point the export() is
encountered leading to an incorrect or incomplete exported
representation. Additionally, the generated IMPORTED_LOCATION
property may even be incorrect if commands following the export()
have an effect on it.

Another problem is that it requires the C++ implementation of cmake
to be capable of computing the exported information at configure time.
This is a limitation on the cleanup and maintenance of the code. At
some point in the future, this limitation will be dropped and more
implementation will be moved from cmTarget to cmGeneratorTarget.
2013-10-07 19:57:06 -04:00
Stephen Kelly fe732264e9 Add the INTERFACE_LIBRARY target type.
This target type only contains INTERFACE_* properties, so it can be
used as a structural node. The target-specific commands enforce
that they may only be used with the INTERFACE keyword when used
with INTERFACE_LIBRARY targets. The old-style target properties
matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for
this target type.

The name of the INTERFACE_LIBRARY must match a validity generator
expression. The validity is similar to that of an ALIAS target,
but with the additional restriction that it may not contain
double colons. Double colons will carry the meaning of IMPORTED
or ALIAS targets in CMake 2.8.13.

An ALIAS target may be created for an INTERFACE library.

At this point it can not be exported and does not appear in the
buildsystem and project files are not created for them. That may
be added as a feature in a later commit.

The generators need some changes to handle the INTERFACE_LIBRARY
targets returned by cmComputeLinkInterface::GetItems. The Ninja
generator does not use that API, so it doesn't require changes
related to that.
2013-10-07 19:56:31 -04:00
Brad King e25dabb3d5 Merge topic 'RunCMake-ignore-valgrind-lines'
4953330 Tests/RunCMake: Tolerate valgrind lines in CMake output
2013-10-07 15:43:41 -04:00
Brad King 49533303a5 Tests/RunCMake: Tolerate valgrind lines in CMake output
When RunCMake tests run during dynamic analysis, valgrind may add lines
of the form "==[0-9]+==..." to the output.  Remove such lines from the
actual output before matching it against the expected output.
2013-09-16 09:59:52 -04:00
Stephen Kelly 2aafaccc5e genex: Test preprocessing incomplete expressions. 2013-09-13 20:10:41 +02:00
Stephen Kelly 81d2793e92 Add differing target property content to policy CMP0022 warning
List the contents of the INTERFACE_LINK_LIBRARIES and the old-style
property.
2013-09-11 22:28:32 +02:00
Brad King ae4630fb1d Merge topic 'fix-RunCMake.Configure-FailCopyFileABI-newlines'
2dce48f Fix RunCMake.Configure test expectation newline matching
2013-08-26 13:14:16 -04:00
Brad King 2dce48ff80 Fix RunCMake.Configure test expectation newline matching
Teach FailCopyFileABI-check.cmake to convert CRLF to LF in the regular
expression read literally from its own source.
2013-08-16 16:10:15 -04:00
Brad King 8da09f6ee1 Merge topic 'cmake-syntax'
9040ec9 Do not warn about left paren not separated by a space
2013-08-15 10:52:45 -04:00
Brad King 9040ec9117 Do not warn about left paren not separated by a space
Since commit 58e52416 (Warn about arguments not separated by whitespace,
2013-02-16) we warn about arguments not separated by spaces.  Loosen the
warning to not complain about left parens not separated by spaces from
the preceding token.  This is common in code like "if(NOT(X))".

Teach the RunCMake.Syntax test to cover cases of left parens not
separated by spaces and check that no warning appears.
2013-08-15 09:00:34 -04:00
Brad King d05a9bd1e6 Cygwin: Avoid legacy warnings in RunCMake.* tests
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32.  The warning appears on stderr
and breaks the expected output matching.
2013-08-13 09:50:15 -04:00
Brad King b93982fb64 Merge branch 'dev/fix-variable-watch-crash' into cmake-syntax
Resolve conflict in Source/cmVariableWatchCommand.cxx by integrating the
changes from both sides.
2013-08-08 13:35:15 -04:00
Ben Boeckel 6aa0c21405 variable_watch: Add test for watching a variable multiple times 2013-08-08 13:31:10 -04:00
Brad King bf73264694 Warn about unquoted arguments that look like long brackets
In the future CMake will introduce Lua-style long bracket syntax.
Warn about unquoted arguments that in the future will be treated
as opening long brackets.

Teach the RunCMake.Syntax test to cover such cases and ensure that the
warning appears.
2013-08-08 13:26:28 -04:00
Brad King 58e524165d Warn about arguments not separated by whitespace
Teach the lexer to return tokens for whitespace.  Teach the parser to
tolerate the space tokens where whitespace is allowed.  Also teach the
parser to diagnose and warn about cases of quoted arguments followed
immediately by another argument.  This was accidentally allowed
previously, so we only warn.

Update the RunCMake.Syntax test case StringNoSpace expected stderr to
include the warnings.
2013-08-08 13:26:27 -04:00
Brad King e945949d14 Add RunCMake.Syntax test cases for command invocation styles
Cover commands with whitespace present in allowed combinations.
Also cover command error cases such as two on one line.
2013-08-08 13:26:27 -04:00
Brad King 1eafa3edaf cmListFileLexer: Fix line number after backslash in string
If a line inside a string ends in a backslash count the following
newline character as a line increment.  Add a test covering this case to
verify that subsequent line numbers are correct.
2013-08-08 13:26:26 -04:00
Brad King f3155cd62a Add RunCMake.Syntax test to cover argument parsing
Test basic unquoted and quoted argument parsing cases including failure
on an unterminated string and an unterminated command invocation.  Also
cover arguments not separated by any spaces, which is accidentally
allowed by the current parser.
2013-08-08 13:26:26 -04:00
Stephen Kelly 370bf55415 Add the ALIAS target concept for libraries and executables.
* The ALIAS name must match a validity regex.
* Executables and libraries may be aliased.
* An ALIAS acts immutable. It can not be used as the lhs
  of target_link_libraries or other commands.
* An ALIAS can be used with add_custom_command, add_custom_target,
  and add_test in the same way regular targets can.
* The target of an ALIAS can be retrieved with the ALIASED_TARGET
  target property.
* An ALIAS does not appear in the generated buildsystem. It
  is kept separate from cmMakefile::Targets for that reason.
* A target may have multiple aliases.
* An ALIAS target may not itself have an alias.
* An IMPORTED target may not have an alias.
* An ALIAS may not be exported or imported.
2013-08-02 15:21:00 +02:00
Stephen Kelly 80e652f5cc Export: Process generator expressions from INCLUDES DESTINATION.
Configuration sensitive expressions are not permitted.
2013-08-01 00:37:25 +02:00
Brad King b728ec3c31 Merge topic 'install-interface-includes'
72d13ff install: Remove error condition using INCLUDES DESTINATION without EXPORT.
2013-07-31 08:48:36 -04:00
Brad King 3dace78c2c Merge topic 'minor-cleanups'
b8dc7fa Genex: Disallow LINKER_LANGUAGE only when used on a static library.
c8a10ba cmTarget: Fix iface libraries and languages for static libraries.
f94bdb3 cmTarget: Remove duplicates when printing traces of tll signatures
ff3d5fa Export: Fix typo of LINK_INTERFACE_LIBRARIES.
79a7a81 Docs: Document variables for default visibility values.
6f6391b Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs.
d8cb47f Docs: Trim trailing whitespace in generated doc.
f10e648 Docs: Document existing target property debugging options.
4f4d69f Qt4Macros: Simplify some variable population.
a413a40 Qt4Macros: Remove undefined varible use.
b60a29e Qt4Macros: Remove unneeded generate CONDITION.
e454cba Docs: Document file(GENERATE) CONDITION as optional.
2013-07-29 09:54:34 -04:00
Stephen Kelly 72d13ff482 install: Remove error condition using INCLUDES DESTINATION without EXPORT.
Commit 650e61f8 (Add a convenient way to add the includes install
dir to the INTERFACE., 2013-01-05) introduced an error case for
using the install(TARGETS) command with specified INCLUDES DESTINATION,
but no specified EXPORT set.

It is convenient to use a variable to set the various destinations
for different outputs (as KDE does), and some targets such as
executables are installed but not exported. This was triggering
the error case, but as it is a common case, remove the error.
2013-07-29 15:16:15 +02:00
Stephen Kelly b8dc7fad23 Genex: Disallow LINKER_LANGUAGE only when used on a static library.
For shared libraries and executables, the linker_language is
indepenedent of the linked libraries.
2013-07-26 16:58:25 +02:00
Brad King c82b1cbe83 Merge topic 'install-interface-includes'
650e61f Add a convenient way to add the includes install dir to the INTERFACE.
2013-07-26 09:01:06 -04:00
Stephen Kelly ff3d5fae5d Export: Fix typo of LINK_INTERFACE_LIBRARIES.
Refer correctly to the old property, not the new one.
2013-07-26 13:10:06 +02:00
Brad King 10e54cd6c9 Merge topic 'dev/export-target-without-language'
5837f19 export: Error when exporting a target without a language
2013-07-25 08:47:49 -04:00
Brad King 17fb435b21 Merge topic 'doc-RunCMake-strips-expected'
c80a4f9 Tests/RunCMake: Document stripping of expected output
2013-07-25 08:47:17 -04:00
Ben Boeckel 5837f19690 export: Error when exporting a target without a language
First, it prevents a NULL dereference and second it reiterates that
targets without languages are not supported by CMake.

Add a RunCMake.ExportWithoutLanguage test exporting a library without a
languages.
2013-07-25 08:44:57 -04:00
Ben Boeckel c80a4f92ce Tests/RunCMake: Document stripping of expected output
Document that trailing newlines are stripped from the -stdout.txt
and -stderr.txt content before using as a regular expression.
2013-07-25 08:38:53 -04:00
Stephen Kelly b655865bbf target_link_libraries: Add PUBLIC/PRIVATE/INTERFACE keyword signature
Add a new signature to help populate INTERFACE_LINK_LIBRARIES and
LINK_LIBRARIES cleanly in a single call.  Add policy CMP0023 to control
whether the keyword signatures can be mixed with uses of the plain
signatures on the same target.
2013-07-24 11:52:44 -04:00
Stephen Kelly 650e61f833 Add a convenient way to add the includes install dir to the INTERFACE.
Export the INCLUDES DESTINATION without appending to the
INTERFACE_INCLUDE_DIRECTORIES of the target itself. That way, a target
can be exported multiple times with different INCLUDES DESTINATION
without unintended cross-pollution of export sets.
2013-07-24 17:32:58 +02:00
Brad King 6077847edc Merge topic 'remove-LINK_LANGUAGE-genex'
4f6bd70 Remove the LINK_LANGUAGE generator expression.
2013-07-24 11:02:14 -04:00
Stephen Kelly 4f6bd7022b Remove the LINK_LANGUAGE generator expression.
It accepted an optional argument to test for equality, but no way
to get the linker language of a particular target.

TARGET_PROPERTY provides this flexibility and STREQUAL provides
the necessary API for equality test.

Extend the CompileDefinitions test to cover accessing the
property of another target.
2013-07-24 10:40:00 -04:00
Brad King 4dc4018553 Teach compiler ABI check to tolerate try_compile COPY_FILE failure
In CMakeDetermineCompilerABI we use try_compile with the COPY_FILE
option to get a copy of the compiled binary used to detect the ABI
information.  We already tolerate the case when compilation fails.
However, when compilation appears to succeed but does not produce the
expected executable the try_compile command immediately reports an error
because the COPY_FILE fails.

Tolerate COPY_FILE failure without stopping the overall configuration
process by using the try_compile COPY_FILE_ERROR option to capture the
error message.  Log the full error to CMakeError.log and simply report
failure to detect the ABI as if compilation had failed.

Teach the RunCMake.Configure test to cover this case and verify that the
messages show up as expected both in stdout and in CMakeError.log.
2013-07-17 15:40:44 -04:00
Brad King 9c119b829d Merge topic 'obsolete-qt4-macros'
cb7f32f Mark qt4_use_modules and qt4_automoc as obsolete.
2013-07-16 13:59:22 -04:00
Brad King fa6106ec56 Merge topic 'target-policies'
484bb88 Genex: Make CMP0021 and CMP0022 usable with TARGET_POLICY
2013-07-15 09:33:47 -04:00
Brad King b6e0972262 Merge topic 'INTERFACE_LINK_LIBRARIES-prop'
3e30d9e TLL: Don't populate old link interface if CMP0022 is NEW.
574fec9 Export: Generate INTERFACE_LINK_LIBRARIES property on targets.
d0a76ea Introduce the INTERFACE_LINK_LIBRARIES property.
ddde61c Introduce the LINK_ONLY generator expression.
5aa9731 GenexEval: Add abstracted access to link interface for a target.
2013-07-15 09:33:42 -04:00
Brad King f6024ef420 Merge topic 'try_compile-COPY_FILE_ERROR'
c28715b try_compile: Add COPY_FILE_ERROR option to capture failure
2013-07-15 09:33:32 -04:00
Brad King c28715b16c try_compile: Add COPY_FILE_ERROR option to capture failure
When the COPY_FILE operation fails optionally capture the error message
with a COPY_FILE_ERROR option instead of reporting the error
immediately.  This gives callers a chance to do something else or report
the error.

Teach the RunCMake.try_compile test to cover bad argument combinations
involving COPY_FILE_ERROR.  Teach the TryCompile test to cover the case
of a COPY_FILE error message captured by COPY_FILE_ERROR.
2013-07-15 09:16:36 -04:00
Stephen Kelly cb7f32f5b8 Mark qt4_use_modules and qt4_automoc as obsolete.
The QT_QMAKE_EXECUTABLE has to be passed through the cmake calls because
the executable may not be in the PATH.
2013-07-14 10:05:04 +02:00
Stephen Kelly 484bb888a0 Genex: Make CMP0021 and CMP0022 usable with TARGET_POLICY
Use preprocessor loops and add a unit test for the appropriate
policies. All policies whose value is recorded at target creation
time should be part of this list.
2013-07-11 11:56:14 +02:00
Brad King 18e1bfbb3c cmake: On configure error suggest looking at CMake*.log files
When CMake reports failure to configure a project, especially when the
toolchain does not initialize properly, the true reason may be clear
from reading the CMakeFiles/CMake(Output|Error).log files.  Advise users
to look at these files if they exist when configuration fails.

Add RunCMake.Configure test to check that the log files are mentioned
when configuration fails.
2013-07-09 15:00:39 -04:00
Stephen Kelly 3e30d9ed67 TLL: Don't populate old link interface if CMP0022 is NEW.
Always populate the INTERFACE_LINK_LIBRARIES for interface
entries. Don't populate the old interface properties
matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?
if CMP0022 is NEW.

Because the INTERFACE_LINK_LIBRARIES property is now populated by
the target_link_libraries when operating on a static library,
make an equivalent change which populates the property with
the same value when the old link_libraries() command is used. This
silences the policy warning in that case.
2013-07-08 22:39:58 +02:00
Stephen Kelly 574fec97fd Export: Generate INTERFACE_LINK_LIBRARIES property on targets.
This property is generated only for targets which have recorded
policy CMP0022 as NEW, and a compatibility mode is added to
additionally export the old interfaces in that case too.

If the old interfaces are not exported, the generated export files
require CMake 2.8.12. Because the unit tests use a version which
is not yet called 2.8.12, temporarily require a lower version.
2013-07-08 22:39:57 +02:00
Stephen Kelly d0a76ea07c Introduce the INTERFACE_LINK_LIBRARIES property.
This property replaces the properties which
match (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?, and is enabled
for IMPORTED targets, and for non-IMPORTED targets only with a policy.

For static libraries, the INTERFACE_LINK_LIBRARIES property is
also used as the source of transitive usage requirements content.
Static libraries still require users to link to all entries in
their LINK_LIBRARIES, but usage requirements such as INCLUDE_DIRECTORIES
COMPILE_DEFINITIONS and COMPILE_OPTIONS can be restricted to only
certain interface libraries.

Because the INTERFACE_LINK_LIBRARIES property is populated unconditionally,
we need to compare the evaluated result of it with the link implementation
to determine whether to issue the policy warning for static libraries. For
shared libraries, the policy warning is issued if the contents of
the INTERFACE_LINK_LIBRARIES property differs from the contents of the
relevant config-specific old LINK_INTERFACE_LIBRARIES property.
2013-07-08 22:39:09 +02:00
Brad King 4e5cb398ae Merge branch 'master' into vs12-generator
Resolve conflicts in Tests/Preprocess/CMakeLists.txt by keeping
the side from 'master'.
2013-06-28 18:29:54 -04:00
Brad King 77ac9b8b9c VS12: Add Visual Studio 12 generator (#14251)
Copy cmGlobalVisualStudio11Generator to cmGlobalVisualStudio12Generator
and update version numbers accordingly.  Add the VS12 enumeration value.
Add module CMakeVS12FindMake to find MSBuild.  Look for MSBuild in its
now-dedicated Windows Registry entry.  Teach the platform module
Windows-MSVC to set MSVC12 and document the variable.  Teach module
InstallRequiredSystemLibraries to look for the VS 12 runtime libraries.

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

Inspired-by: Minmin Gong <minmin.gong@gmail.com>
2013-06-28 18:13:14 -04:00
Stephen Kelly ff015ee11e Genex: Report error if a target file is needed to evaluate link libraries.
Constructs such as

 target_link_libraries(foo $<$<STREQUAL:$<TARGET_FILE:foo>,foo.so>:bar>)

segfault before this patch.
2013-06-24 16:22:15 +02:00
Stephen Kelly b1c19ce383 Genex: Make LINK_LANGUAGE report an error when evaluating link libraries. 2013-06-24 16:21:53 +02:00
Brad King 059be4ba3b Merge topic 'add-whitespace'
2331b57 Add whitespace after colons in error messages.
2013-06-24 08:38:12 -04:00
Stephen Kelly 2331b57bec Add whitespace after colons in error messages. 2013-06-21 16:21:44 +02:00
Brad King 482f1122ad try_compile: Add signature to allow multiple SOURCES
Extend the signature

 try_compile(RESULT_VAR <bindir> <srcfile> ...)

to allow multiple sources as

 try_compile(RESULT_VAR <bindir> SOURCES <srcfile>... ...)

Process the sources to generate a CMakeLists.txt that enables all needed
languages.

Teach the TryCompile test to try cases with two sources of the same
language and of mixed languages.  Teach RunCMake.try_compile to cover
error cases for the signature.
2013-06-06 14:35:20 -04:00
Brad King c02f01b039 Merge topic 'fix-path-root-dot-dot'
d26800b get_filename_component: Test ABSOLUTE of .. after root component
2013-06-05 09:39:48 -04:00
Brad King ff8917fdd2 Merge topic 'VISIBILITY_PRESET-property'
cd1fa53 Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.
0e9f4bc Introduce target property <LANG>_VISIBILITY_PRESET
2013-06-05 09:38:59 -04:00
Brad King d26800bc40 get_filename_component: Test ABSOLUTE of .. after root component
Teach the RunCMake.get_filename_component test to verify that ".." does
not remove the root filename component.
2013-06-04 09:09:22 -04:00
Brad King 647745b3ee variable_watch: Print accesses as "CMake Debug Log" messages
Use makefile->IssueMessage() to print the unprocessed watch message in a
format consistent with other CMake messages and with a more complete
call stack for the access.
2013-06-03 13:19:59 -04:00
Brad King 515f9af0d4 variable_watch: Remove leftover debugging code (#14187)
When a watch does not specify a command to call then variable_watch
prints out a message to stderr.  Remove code after that which collects
all variable values to construct a message that is never printed.
Otherwise such code causes a READ_ACCESS watch to trigger on all
variables in the currents scope.

Reported-by: Yichao Yu <yyc1992@gmail.com>
2013-06-03 13:13:07 -04:00
Brad King c63d30048b variable_watch: Add test for MODIFIED_ACCESS report
Add a RunCMake.variable_watch watch test to cover the basic use case.
2013-06-03 10:20:31 -04:00
Stephen Kelly 0e9f4bc00c Introduce target property <LANG>_VISIBILITY_PRESET
This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target
property is used as the operand to the -fvisibility= compile option
with GNU compilers and clang.
2013-06-02 12:00:51 +02:00
Brad King d06db7ebe8 try_compile: Refactor argument processing
Process all arguments in a single loop using a simple state machine.
While at it, fix some error message typos.  Also allow LINK_LIBRARIES
with no actual libraries to disable use of the -DLINK_LIBRARIES=...
from the CMAKE_FLAGS.  This was already possible in the old logic if
LINK_LIBRARIES was immediately followed by another keyword argument
instead of the end of the argument list, so allow it in general.
Update the RunCMake.try_compile test cases accordingly.
2013-05-31 10:01:50 -04:00
Brad King b680824a5f try_compile: Add test for bad call error cases
Add a RunCMake.try_compile test to cover cases of bad invocation of the
try_compile command.
2013-05-31 10:00:42 -04:00
Brad King 585cfa51de Merge topic 'fix-FileIsDirectory-SEGV'
7378792 if: Add test for IS_DIRECTORY
4ab10e0 Merge branch 'master' into fix-FileIsDirectory-SEGV
045d6ae KWSys: Fix SystemTools::FileIsDirectory with long paths (#14176)
2013-05-30 08:57:42 -04:00
Brad King 7378792b49 if: Add test for IS_DIRECTORY
Add a RunCMake.if test to cover if() command behavior.  Start with a
test for IS_DIRECTORY cases with an existing directory and a long path,
both with a trailing slash.
2013-05-28 11:35:32 -04:00
Brad King 07942da96c Merge topic 'ExternalData-no-re-stage'
c35961b ExternalData: Do not re-stage staged object files
2013-05-28 10:42:33 -04:00
Brad King be85fa4a89 Merge topic 'genex-generate-file'
b983a58 file: Add GENERATE command to produce files at generate time
2013-05-28 10:42:18 -04:00
Brad King c35961b010 ExternalData: Do not re-stage staged object files
The ExternalData_LINK_CONTENT option tells ExternalData to convert real
data files it finds into content links and to "stage" the original
content in a ".ExternalData_<algo>_<hash>" file.  However, after a data
object has been staged it is possible that a user-provided pattern in
the "REGEX:" option will later match the staged object file.  We must
not process staged object files even when a user pattern matches them.

Fix the implementation to not match a staged object file as a normal
data file for conversion.  Extend the RunCMake.ExternalData test to
cover this case.
2013-05-24 15:45:38 -04:00
Stephen Kelly b983a58bdf file: Add GENERATE command to produce files at generate time
The idea is to write to a temp file which contains generator
expressions, and at generate time, evaluate the generator expressions,
and write the result to a file.

Because executables on Windows are limited in the length of command line
it is possible to use, it is common to write command line arguments to a
file instead and specify the file as a source of arguments.

This new FILE(GENERATE) subcommand allows the use of generator
expressions to create such files so that they can be used with
add_custom_command for example.
2013-05-24 09:02:45 -04:00
Brad King 5947d03987 Merge topic 'error-on-exported-missing-include-dir'
eabefa8 Error on relative path in INCLUDE_DIRECTORIES target property.
2013-05-21 15:13:26 -04:00
Stephen Kelly eabefa8b02 Error on relative path in INCLUDE_DIRECTORIES target property.
Add policy CMP0021 to preserve existing behavior in projects expecting
it from earlier CMake versions.
2013-05-21 14:59:17 -04:00
Brad King 0dc0e7d885 Merge topic 'doc-improvements'
7cc2805 Docs: Clarify wording "flag used" => "flag (to|will) be used"
2378a69 Docs: Clarify that CMAKE_*_(PREFIX|SUFFIX) affect filenames
56ca34d Docs: Update description of CMAKE_(BUILD_TYPE|CONFIGURATION_TYPES)
2bab472 VS10: add detailed comment about MIDL processing
e619111 Explain distribution of Win9x binary on all Windows versions.
5ca4336 FindwxWidgets: add DOC strings with usual style
f57800d Fix spelling and typos (product names)
bf019d7 Fix spelling and typos (non-binary)
ddac8d3 Fix spelling and typos (affecting binary data / module messages)
86832ce Fix spelling and typos (affecting users)
2013-05-16 14:38:07 -04:00
Brad King b547b99a70 Merge topic 'fix-per-config-tll-include-dirs'
88308bc Test that linking using the debug keyword to tll works.
20104ab Test transitive includes from setting the LINK_LIBRARIES property.
2013-05-16 14:37:55 -04:00
Andreas Mohr ddac8d3d2d Fix spelling and typos (affecting binary data / module messages) 2013-05-07 08:39:19 -04:00
Stephen Kelly 20104ab2d8 Test transitive includes from setting the LINK_LIBRARIES property.
Commit b8259c3d (Centralize maintenance of usage requirement include
directories, 2013-04-29) changed the handling of the property.
Previously setting the property directly instead of via
target_link_libraries would not result in transitive include
directory handling.
2013-05-06 18:11:56 +02:00
Brad King 7d1590e6f9 get_filename_component: Add DIRECTORY option (#14091)
The name "PATH" is not precise so add equivalent option "DIRECTORY".
Document the latter as preferred and the former as a legacy alias.
2013-04-16 09:37:37 -04:00
Brad King ec1ba9b0ae get_filename_component: Add explicit unit tests
Add test RunCMake.get_filename_component to cover cases of the command.
Remove redundant coverage of these cases from the "complex" tests.
2013-04-16 09:35:29 -04:00
Brad King de13d68d11 add_dependencies: Distinguish target v. file dependencies in error (#14050)
When called with a non-existent LHS target name the user may be trying
to add file-level dependencies.  Clarify the error message to explain
the difference between target-level and file-level dependencies.  Point
the reader at the commands and options needed for the latter.
2013-03-29 15:00:33 -04:00
Brad King 4ce263288a Merge topic 'fix-Qt5-incompatibility-check-version'
535e53c Fix the Qt 5 version required to run the IncompatibleQt test.
2013-03-28 10:43:02 -04:00
Stephen Kelly 535e53c7cc Fix the Qt 5 version required to run the IncompatibleQt test.
The commit to add the INTERFACE_QT_MAJOR_VERSION in qtbase.git
is 14054d45 (Set the INTERFACE_QT_MAJOR_VERSION to 5., 2013-03-16)
which will be part of Qt 5.1.0.

If there is a Qt 5.0.3 release, there is no guarantee it will
contain that commit. Make sure such a Qt version does not fail
with this test if not.
2013-03-27 00:15:08 +01:00
Stephen Kelly 634bb33f3a Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
We can do this check only if the TargetName is non-empty, which means
that we're evaluating INTERFACE_INCLUDE_DIRECTORIES from a linked
dependency which was set using target_link_libraries.

It is possible to have relative paths in INCLUDE_DIRECTORIES already
in CMake 2.8.10.2, so that part will require a policy to fix.
2013-03-26 19:56:10 +01:00
Stephen Kelly 28051f1150 Report an error on IMPORTED targets with a faulty INTERFACE
It is considered an error if the INTERFACE_INCLUDE_DIRECTORIES contains
a directory which does not exist, which indicates a programmer error
by the upstream, or a packaging error.

One of the RunCMake.CompatibleInterface tests also needs to be updated
due to this change. Non-existant includes were used in the test, but
are not needed.
2013-03-26 10:45:28 -04:00
Stephen Kelly af81a3c31b install(EXPORT): Ensure clean INTERFACE_INCLUDE_DIRECTORIES
Check that source and binary directories are not part of the
INTERFACE_INCLUDE_DIRECTORIES for installed IMPORTED targets.

This is limited to directories which do not contain generator
expressions to evaluate. Such paths can only be checked at time
of use of the imported target, which will be done in a follow up
patch.
2013-03-26 10:45:07 -04:00
Stephen Kelly 4aa10cd6d6 FindQt4: Set the INTERFACE_QT_MAJOR_VERSION for Qt4::QtCore
With a similar commit in Qt 5, this will error at CMake time if
an attempt is made to use

 target_link_libraries(foo Qt4::QtCore Qt5::Core)
2013-03-18 09:31:33 -04:00
Brad King 8128940ac1 Merge topic 'cleanup-early-include-CTest-failure'
d90f49b CTest: Fail early without PROJECT_BINARY_DIR (#14005)
2e1c2bd build_command: Fail early without CMAKE_MAKE_PROGRAM (#14005)
4e5cb37 Refactor RunCMake.build_command test to allow more cases
2013-03-13 13:34:36 -04:00
Brad King d90f49b894 CTest: Fail early without PROJECT_BINARY_DIR (#14005)
Do not use PROJECT_BINARY_DIR before it is defined.  If it is not
defined when needed, fail with an error message suggesting that the
project() command be invoked first.
2013-03-12 18:20:44 -04:00