Commit Graph

662 Commits

Author SHA1 Message Date
Brad King d805767545 Merge branch 'empty-LINK_LIBRARIES' into release 2015-07-08 13:27:29 -04:00
Brad King 7aa9e80e35 set_property: Fix crash when setting LINK_LIBRARIES to nothing
We use a special dedicated structure to store the LINK_LIBRARIES target
property.  Do not try to construct a string from a NULL value.  Instead
leave the property structure empty when no value is given.

Reported-by: Ghyslain Leclerc <ghleclerc@gmail.com>
2015-07-08 13:23:16 -04:00
Brad King e4a9346dba Merge branch 'fix-target_link_libraries-wrong-dir' into release 2015-06-25 10:11:50 -04:00
Brad King 30c2e1dd16 cmTarget: Fix diagnostic of target_link_libraries in wrong directory (#15626)
Since commit v3.3.0-rc1~62^2~5 (cmTarget: Store only cmListFileContext
for CMP0023 handling, 2015-05-18) a call to target_link_libraries on a
target that was defined in another (non-ancestor) directory crashes
because no execution context is left active.  Fix this by getting the
execution context from the actual cmMakefile where the current
target_link_libraries call takes place.  Test this by verifying that
such calls correctly produce an error diagnostic instead of crashing.
2015-06-25 09:14:26 -04:00
Brad King 38ee28bfd5 Merge branch 'fix-function-missing-end' into release 2015-06-22 11:46:09 -04:00
Brad King 5d85fb4f40 Fix assertion failure on unmatched function or macro
The fix in commit v3.2.3~3^2 (Fix assertion failure on unmatched foreach
in function, 2015-05-18) broke handling of unmatched non-loop blocks
because it assumed all function blockers removed during error unwinding
were for loops, essentially switching the set of mishandled cases.

The purpose of the loop block push/pop operations is to define a scope
matching the lifetime of the loop function blockers.  Since our function
blockers already have the proper lifetime, simply move the push/pop
operations to their constructor/destructor.

Extend the RunCMake.Syntax test with a case covering this.
2015-06-22 11:41:51 -04:00
Brad King 836c4e9314 Merge topic 'FindPkgConfig_fix_extra_path'
d4c6531a FindPkgConfig: Fix extra paths for CMAKE_{FRAMEWORK,APPBUNDLE}_PATH vars
2015-06-01 09:37:34 -04:00
Raffi Enficiaud 8444809c47 FindMatlab: fix reconfiguration of Matlab_ROOT_DIR 2015-06-01 09:24:06 -04:00
Daniele E. Domenichelli d4c6531a94 FindPkgConfig: Fix extra paths for CMAKE_{FRAMEWORK,APPBUNDLE}_PATH vars
The CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH cache variables are
supposed to be used to generate the extra paths passed to pkg-config,
but instead the CMAKE_PREFIX_PATH variable is used.

This bug was introduced by the refactor in commit v3.1.0-rc1~747^2~1.
2015-05-29 19:22:57 +02:00
Brad King 89253992b8 Tests: Add case for rejecting $<TARGET_FILE:...> on an INTERFACE library
Add an explicit test for this existing error.  We already cover it for
an OBJECT library but INTERFACE libraries are not allowed either.
2015-05-26 11:53:36 -04:00
Brad King 12b9005d7c Merge topic 'extend-visibility-properties'
700f1c3b Honor visibility properties for all target types (#15556)
50de5dbb Help: Format visibility property and variable documentation
771f1b00 Tests: Rename Visibility{InlinesHidden =>}
ab55b3b5 Tests: Refactor RunCMake.VisibilityPreset test setup
2015-05-26 09:24:00 -04:00
Brad King 3638641396 Merge topic 'run-include-what-you-use'
b3475ba5 Makefile: Fix <LANG>_INCLUDE_WHAT_YOU_USE with CTEST_USE_LAUNCHERS
2015-05-26 09:23:54 -04:00
Brad King 700f1c3b2b Honor visibility properties for all target types (#15556)
The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN were first
merged in commit v2.8.12~322 (Merge topic 'VISIBILITY_PRESET-property',
2013-06-05) but worked only for shared libraries and executables with
exports.  Prior to commit v3.0.0-rc1~581^2 (GenerateExportHeader:
Deprecate add_compiler_export_flags function., 2013-09-02) the
add_compiler_export_flags function was used to add visibility flags to
all targets.

The visibility flags are useful for sources in all target types because
they may be later linked into shared libraries or executables with
exports.  Introduce policy CMP0063 to enable them for all target types
while preserving compatibility with existing projects that do not expect
this.
2015-05-26 09:03:16 -04:00
Brad King ab55b3b5fa Tests: Refactor RunCMake.VisibilityPreset test setup
Enable languages only in the individual test case.  Enable the test
everywhere except Visual Studio generators (which do not implement the
properties) and just set fake flags as needed to activate relevant code
paths.  Drop unneeded CMAKE_SUPPRESS_REGENERATION which seems to have
been copied from an unrelated test when this test was created.
2015-05-22 14:56:00 -04:00
Brad King b3475ba57b Makefile: Fix <LANG>_INCLUDE_WHAT_YOU_USE with CTEST_USE_LAUNCHERS
The 'ctest --launch' command must be placed before the IWYU launcher on
the compiler command line.  Extend the RunCMake.IncludeWhatYouUse test
to cover this case.  The Ninja generator already does it correctly.
2015-05-22 08:44:46 -04:00
Brad King 03a65dab30 Merge topic 'run-include-what-you-use'
ada5ffce Add options to run include-what-you-use with the compiler
67fa3da9 cmake: Add internal -E mode to run include-what-you-use with the compiler
2015-05-21 09:03:40 -04:00
Brad King ada5ffce7b Add options to run include-what-you-use with the compiler
Create a <LANG>_INCLUDE_WHAT_YOU_USE target property (initialized by a
CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE variable) to specify an IWYU command
line to be run along with the compiler.
2015-05-19 13:16:29 -04:00
Bill Hoffman 67fa3da9e8 cmake: Add internal -E mode to run include-what-you-use with the compiler
Add an internal "cmake -E __run_iwyu" mode to wrap the compiler call.
Run a given include-what-you-use command line with the compiler options
and report a warning if it finds anything.  Then run the real compiler.

Co-Author: Brad King <brad.king@kitware.com>
2015-05-19 13:16:29 -04:00
Brad King 594dd9b36a Merge topic 'use-std-unordered_map'
d7923b82 Use std::unordered_map instead of hash_map where available.
820777af Tests: Don't rely on ordering of targets in maps.
921d74d8 AutoGen: Don't iterate over a container while populating it.
2015-05-19 11:30:21 -04:00
Brad King 0cbc69b9ea Merge topic 'minor-cleanups'
61d52e6e cmListFileBacktrace: Hide the context-stack implementation detail.
a271f7f1 cmTarget: Simplify CMP0023 message loop.
f4300cd4 cmTarget: Simplify output computation.
65a42849 cmTarget: Store context in stack only if different.
9645cba3 cmListFileContext: Implement EqualityComparable.
52a8d19c cmTarget: Store only cmListFileContext for CMP0023 handling.
59ba1215 cmTarget: Remove needless iteration.
18f810a8 cmListFileContext: Sort by line before file.
e96b5d14 cmListFileContext: Implement LessThanComparable.
7eb0dfa0 cmMakefile: Use std::set::insert API to simplify CMP0054 handling.
f9785e0c cmMakefile: Simplify CMP0054 handling.
e17b5e42 cmMakefile: Add access to the top-level execution context.
1ec1bf9f if(): Test the effect of cmMakefileCall use in elseif() handling.
9b4aefad cmMakefile: Replace deques with vectors.
2015-05-19 11:09:36 -04:00
Brad King aa68f2e4c9 Merge topic 'fix-function-missing-endforeach'
3a656065 Fix assertion failure on unmatched foreach in function (#15572)
2015-05-19 11:09:21 -04:00
Stephen Kelly 1ec1bf9f07 if(): Test the effect of cmMakefileCall use in elseif() handling. 2015-05-18 21:28:09 +02:00
Brad King 3a65606591 Fix assertion failure on unmatched foreach in function (#15572)
The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track
nested loop levels in CMake language with a stack of counters,
2014-11-18) forgot to account for scopes popped by error messages about
unclosed scopes.  Teach the error handler to pop the lexical scope it
reports as unclosed.  Re-order the lexical scope RAII object to be
inside the variable scope RAII object scope so that the lexical scope
is fully closed before we check assertions about variable scopes.

Extend the RunCMake.Syntax test with a case covering this.
2015-05-18 11:13:05 -04:00
Stephen Kelly 820777af03 Tests: Don't rely on ordering of targets in maps. 2015-05-17 11:19:20 +02:00
Brad King 2e4ea0c055 Merge topic 'refactor-cmLocalGenerator'
ce167b54 cmMakefile: Handle CMP0014 before configuring the generator.
7baef756 cmLocalGenerator: Assert that there is a parent.
63255342 cmMakefile: Remove redundant variable set.
894961af cmMakefile: Use the state to determine the parent directory.
115e9199 Use new top-level check abstraction.
c5059c90 cmLocalGenerator: Add abstraction to check if top-level.
b17686d2 cmGlobalGenerator: Move some flags from cmLocalGenerator.
ed41a8e7 cmLocalGenerator: Port loops to cmState::Snapshot.
48a9e91b cmState: Add an accessor for Parent snapshot and a validity check.
e7f7c2e2 cmLocalGenerator: Convert two recursive methods to loops.
c5cb3a73 cmLocalGenerator: Get project directories from the cmState.
76b59831 cmLocalGenerator: Initialize state before creating cmMakefile.
34c9ee2e cmLocalGenerator: Require a global generator in the constructor.
3837c483 Tests: Add case for 'ctest' run with bad CTestTestfile
b317b38d cmGlobalBorlandMakefileGenerator: Do not inherit from NMake generator
94867698 Don't use a cmLocalGenerator instance to call static methods.
...
2015-05-15 11:22:36 -04:00
Brad King 912dff6253 Merge topic 'disallow-install-of-export'
b85d3b66 install: Disallow installing export() result.
501c237a install: Use an intermediate filesVector variable.
2015-05-15 11:22:29 -04:00
Stephen Kelly b85d3b66c6 install: Disallow installing export() result. 2015-05-14 21:38:29 +02:00
Brad King 3837c48334 Tests: Add case for 'ctest' run with bad CTestTestfile 2015-05-14 20:36:27 +02:00
Brad King d430cb7c36 Tests: Fix failures when running under the default install prefix (#15566)
Fix test cases whose behavior differs when their source or build tree is
under CMAKE_INSTALL_PREFIX by setting an install prefix under the build
tree.  Otherwise they may fail when run under the default install prefix
(e.g. /usr/local).
2015-05-14 10:07:37 -04:00
Brad King 53bb51fc31 Merge topic 'ctest-no-make-i'
226df303 CTest: Stop telling 'make' to ignore errors with -i
28e7a135 Help: Fix build_command alternative signature docs
231601b6 build_command: Choose configuration consistently across signatures
2015-05-12 09:12:56 -04:00
Brad King 55fe56444f Merge topic 'ExternalProject-improve-missing-source-error'
dcb18836 ExternalProject: Improve error when SOURCE_DIR is missing (#15560)
2015-05-12 09:12:43 -04:00
Brad King 226df303f9 CTest: Stop telling 'make' to ignore errors with -i
Add policy CMP0061 to maintain compatibility for existing projects.
2015-05-12 09:06:49 -04:00
Brad King dcb188363d ExternalProject: Improve error when SOURCE_DIR is missing (#15560)
Mention the SOURCE_DIR that we checked and found empty or missing
so that the user can see the full path to what we expected to find.
2015-05-08 09:20:43 -04:00
Brad King f65bb82f36 execute_process: Improve stdout/stderr merging
Use the KWSys Process "MergeOutput" option to give the child process
the same pipe (or file) for both stdout and stderr.  This allows
natural merging of stdout and stderr together instead of merging
on arbitrary buffered read boundaries as before.
2015-05-07 14:40:38 -04:00
Brad King 88c5ec72b0 Merge topic 'test-RunCMake-parallel-make'
703e7625 Tests: Protect RunCMake tests from MAKEFLAGS in environment (#15542)
2015-04-30 10:32:15 -04:00
Nils Gladitz aed6239e40 if: Implement new IN_LIST operator 2015-04-30 10:21:19 -04:00
Nils Gladitz 32a2f41402 Revert "add_custom_command: Diagnose MAIN_DEPENDENCY limitation."
This reverts commit 242c3966 (add_custom_command: Diagnose
MAIN_DEPENDENCY limitation, 2015-03-09) and the follow up commit
b372a99a (UseSWIG: Do not use MAIN_DEPENDENCY on custom commands,
2015-03-26).

I misdiagnosed the underlying issue that prompted creation of policy CMP0057.
The actual issue surfaces when a single custom command's MAIN_DEPENDENCY
is listed in more than one target; this issue will have to be addressed
independently.
2015-04-30 10:20:20 -04:00
Brad King 703e762529 Tests: Protect RunCMake tests from MAKEFLAGS in environment (#15542) 2015-04-29 16:14:52 -04:00
Brad King f0673c1022 Merge topic 'deterministic-CTest-tests'
bf24b6c5 Tests: Guard more CTest tests against parallel execution.
2015-04-28 13:55:57 -04:00
Stephen Kelly bf24b6c501 Tests: Guard more CTest tests against parallel execution. 2015-04-27 22:03:40 +02:00
Brad King 75bd5ca06a Tests: Fix RunCMake.CTest to tolerate source line number changes 2015-04-27 10:46:52 -04:00
Brad King 195a724c57 Merge topic 'deterministic-CTest-tests'
b5b20d20 ctest: Treat ENV{CTEST_OUTPUT_ON_FAILURE} as a boolean
fcf9cf6c Tests: Make a CTest test deterministic.
2015-04-23 09:04:33 -04:00
Brad King e1c6df392b ExternalProject: Allow dependencies on INTERFACE libraries
Respect INTERFACE library property whitelist.  Check that a target has
type "UTILITY" before querying other properties.
2015-04-22 08:48:52 -04:00
Andrey Pokrovskiy 7bd8cfb813 ExternalProject: Allow generator expressions in initial cache options
Use file(GENERATE) to write the initial cache file so that we can
evaluate generator expressions.  Use a per-config initial cache file
name in case the content varies by configuration.
2015-04-21 10:50:29 -04:00
Brad King 3961ccb972 Merge topic 'ExternalProject-test-refactor'
28429270 Tests: Delay RunCMake.ExternalProject case checks
2015-04-21 08:44:54 -04:00
Stephen Kelly fcf9cf6cd8 Tests: Make a CTest test deterministic.
The test expect sub-test not to run in parallel.
2015-04-21 00:31:02 +02:00
Brad King da65528c36 Merge topic 'stable-xcode-projects'
6693590f Xcode: Refine quoting rules for Strings
a6331eb8 Xcode: Let PrintComment decide if the comment is non-empty
6e8952c1 Xcode: PrintComment will prepend a whitespace itself before the comment
4bd2544b Xcode: Do not add whitespace after attribute group opening brace
5cb4c838 Xcode: Properly indent PBXFileReference and PBXBuildFile
a723427b Xcode: Remove extra space in PBXProject comment
2fe8bca5 Xcode: Add comment after root object
2e0e205e Xcode: Indent using tabs
7b68c8df Xcode: Sort Xcode objects by Id
2015-04-20 14:02:48 -04:00
Brad King 2842927019 Tests: Delay RunCMake.ExternalProject case checks
Use RunCMake "-check.cmake" scripts to check the generated initial cache
file content so that the full generation process is completed.
2015-04-20 10:27:19 -04:00
Gregor Jasny 6693590f81 Xcode: Refine quoting rules for Strings
$ and . do not need to be quoted, but brackets and * must be to
not confuse the Xcode parser.
2015-04-17 21:50:05 +02:00
Brad King 7b8e7c4ac3 Deprecate Visual Studio 7 generator (.NET 2002)
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2015-04-15 09:21:24 -04:00