Commit Graph

136 Commits

Author SHA1 Message Date
Brad King 8def82585c Merge topic 'try-run-link-libraries'
d0adcccb try_run: Add tests for LINK_LIBRARIES with mock libraries.
223c5cb7 try_run: Add test for bad link libraries.
e2b1f058 try_run: Add support for LINK_LIBRARIES option.
2015-01-26 10:28:25 -05:00
Matt McCormick 223c5cb70b try_run: Add test for bad link libraries.
Based off the corresponding try_compile test.
2015-01-26 10:05:30 -05:00
Brad King 352de1d749 Tests: Add RunCMake.CTestSubmit cases covering ctest_submit failures
Cover command invocation argument errors.  Prepare infrastructure
to cover failed 'drop' cases, but do not cover them yet because
we need to collect error messages from each platform.
2015-01-19 09:53:57 -05:00
Brad King cb5fc7b993 Merge topic 'fix-empty-target-property-queries'
c6d03a10 tests: add tests for querying properties
76ff92e0 set_tests_properties: fix documentation
28214862 get_test_property: clarify the documentation
34a99094 get_target_property: discern empty from undefined properties (#15333)
2015-01-11 12:00:20 -05:00
Ben Boeckel c6d03a1072 tests: add tests for querying properties 2015-01-11 11:45:44 -05:00
Brad King 1651dc9668 Tests: Move CTestTestMemcheck cases into a RunCMake.CTestMemcheck test
The CTestTestMemcheck test cases all try to check the ctest output with
a regular expression.  They fail intermittently due to ordering of the
portions of the output that come from stdout and stderr being mixed.
Convert all the test cases to use the RunCMake infrastructure to match
stdout and stderr separately.
2014-12-18 10:12:15 -05:00
Brad King a85ee8b8cf Tests: Simplify RunCMake test extra argument passing
Allow add_RunCMake_test calls to pass non-optional arguments
immediately.
2014-12-15 16:46:49 -05:00
Brad King da7155f5bc Tests: Allow RunCMake tests to pass generator expressions 2014-12-15 16:46:49 -05:00
Brad King ce331bab92 find_library: Fix repeat call after changing directory content (#15293)
We use cmGlobalGenerator::GetDirectoryContent to avoid repeating
directory listings.  However, GetDirectoryContent loads content from
disk at most once.  This breaks find_library calls that occur when disk
content has changed since preceding find_library calls.

Teach cmGlobalGenerator::GetDirectoryContent to save the directory
modification time when content is loaded and re-load content if it
changes.

Create a RunCMake.find_library test with a case covering this.
2014-12-08 15:35:50 -05:00
Gregor Jasny 0de867dde2 continue: Add a new CMake language command for loop continuation (#14013)
Inspired-by: Doug Barbieri
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-12-01 09:50:49 -05:00
Brad King 82582c96bd Merge topic 'break-command-strictness'
d54617d0 break: Add policy CMP0055 to check calls strictly
bae604d9 Track nested loop levels in CMake language with a stack of counters
2014-11-26 13:50:47 -05:00
Gregor Jasny d124c41168 return: Add test for returning inside a foreach loop
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-11-25 14:37:39 -05:00
Gregor Jasny d54617d006 break: Add policy CMP0055 to check calls strictly
Reject break() without loop scope or any arguments.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-11-25 14:14:20 -05:00
Brad King 39baf728b7 Tests: Test add_custom_command and add_custom_target error cases
Add RunCMake.add_custom_command and RunCMake.add_custom_target tests to
cover the error messages for these commands.
2014-11-14 11:43:35 -05:00
Daniele E. Domenichelli 609037f482 ExternalProject: Add unit tests for CMAKE_CACHE_DEFAULT_ARGS 2014-10-31 11:34:11 -04:00
Sylvain Joubert 6120fca8e2 Ninja: Prevent compilers to be silently modified
Unlike with Unix Makefiles generator modifying compiler paths was not
protected with Ninja generator.  It was possible to modify them in the
cache without the expected effect on the generated solution.  Also
activate corresponding tests with Ninja.
2014-09-22 08:44:39 -04:00
Brad King 9edf6903e6 Merge topic 'if-sanity'
858d5a0b Fix if() checks of CMAKE_SYSTEM_NAME on Cygwin
e177e7af FPHSA: Avoid if() dereferencing of quoted variable
425acc52 cmcurl: Use if(DEFINED) to simplify conditions
cede5cbd libarchive: Avoid depending on if() to dereference a quoted variable
2d97178b FindGTK2: Avoid depending on if() to dereference a quoted variable
0b12815d Modules/Test*.cmake: Use if(DEFINED) to simplify conditions
188a1f23 If: Introduce policy CMP0054 - don't dereference quoted variables in if()
b900c1cc If: Extract cmConditionEvaluator from if() implementation
2014-09-15 10:27:36 -04:00
Nils Gladitz 188a1f236e If: Introduce policy CMP0054 - don't dereference quoted variables in if() 2014-09-11 21:23:17 +02:00
Brad King 09ab207c66 Tests: Add generator platform support
Propagate CMAKE_GENERATOR_PLATFORM through the test hierarchy so that all
tests can build with the selected generator platform, if any.
2014-09-10 11:21:50 -04:00
Brad King 0f1f1271e6 CMake: Add CMAKE_GENERATOR_PLATFORM option
Reject the option by default.  It will be implemented on a per-generator
basis.  Pass the setting into try_compile project generation.  Add cache
entry CMAKE_GENERATOR_PLATFORM and associated variable documentation to
hold the value persistently.

Add a RunCMake.GeneratorPlatform test to cover basic use cases for the
option.  Verify that CMAKE_GENERATOR_PLATFORM is empty by default, and
that it is rejected when the generator does not support a user setting.
2014-09-05 14:38:05 -04:00
Nils Gladitz f86850ef60 Genex: Implement generator expressions for target PDB files. 2014-07-31 09:17:53 -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 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
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 2c448dbfe7 file: Report system error on failure to open file 2014-05-20 11:07:51 -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 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
Stephen Kelly 597bb72ed7 Tests: Run RunCMake.target_compile_features unconditionally.
It is so far testing only cases which are fatal regardless of
recorded features.
2014-04-16 17:22:19 +02:00
Stephen Kelly 8ed59fc207 Add target_compile_features command.
This can be used to set the compiler features required by particular
targets. An error is issued at CMake time if the compiler does not
support the required feature. If a language dialect flag is required
by the features used, that will be added automatically.

Base the target_compile_features command on cmTargetPropCommandBase. This
gives us 'free' handling of IMPORTED, ALIAS, INTERFACE, non-compilable
and missing targets.
2014-04-07 18:11:18 +02:00
Stephen Kelly f97bf4370c Features: Add cxx_auto_type.
Record the availability of this feature for GNU 4.8 on (UNIX AND
NOT APPLE) only.  In the future, availability can be recorded for
earlier GNU, for other platforms and for other compilers. Initially
the affected configurations are as restricted as possible to allow
for easy testing while extending the features vector in only one
dimension.

The error message when using the set_property API directly is not
very good, but follow up commits will provide origin debugging of
the property and a target_compile_features command which will
provide a configure-time backtrace when possible.
2014-04-07 18:11:18 +02:00
Stephen Kelly e6971df6ab cmTarget: Make the source files depend on the config.
Disallow the use of config-specific source files with
the Visual Studio and Xcode generators. They don't have
any way to represent the condition currently.

Use the same common-config API in cmQtAutoGenerators. While
it accepts config-specific files, it doesn't have to support
multiple configurations yet.

Loop over the configs in cmTargetTraceDependencies
and cmGlobalGenerator::WriteSummary and consume all source
files.

Loop over the configs in cmComputeTargetDepends and compute the
object library dependencies for each config.
2014-04-02 23:14:02 +02:00
Stephen Kelly 5702e10677 cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
Add policy CMP0051 to control this behavior.
2014-04-02 23:12:56 +02:00
Stephen Kelly bf98cc252f Genex: Evaluate TARGET_OBJECTS as a normal expression. 2014-03-31 23:18:44 +02:00
Brad King 565213c1fd Merge topic 'configure_file-unicode'
98383f80 Unicode: check encoding of files given to configure_file.
2014-03-20 09:22:28 -04: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
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
Stephen Kelly f74a8405b6 Test error cases in find_dependency. 2014-03-11 14:48:35 +01: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
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 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 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 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
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