Commit Graph

3240 Commits

Author SHA1 Message Date
Brad King 87be2e1427 Do not call setlocale() globally in CMake applications (#15377)
Revert the changes made by commit v3.1.0-rc1~406^2~1 (Encoding: Add
setlocale() to applications, 2014-05-30) and commit v3.1.0-rc1~406^2
(Encoding: Change to only set LC_CTYPE, 2014-06-11), and other setlocale
calls added later in their spirit.  CMake has not been taught how to
deal with non-C locales everywhere.  We do not define any functionality
for character conversions for non-ASCII strings.  Another solution will
be needed to address the original problem motivating addition of
setlocale() calls.
2015-02-06 13:32:26 -05:00
Brad King 9259d77881 Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
Custom command path normalization added in commit v3.1.0-rc1~471^2
(add_custom_command: Normalize OUTPUT and DEPENDS paths, 2014-05-28)
broke use of OBJECT_DEPENDS to bring in custom commands because the
latter paths were not normalized too.  Normalize them and add a test
case.

Reported-by: Daniel v. Gerpen
2015-01-28 09:06:21 -05:00
Brad King a08a444bab Merge branch 'fix-LOCATION-with-TARGET_OBJECTS' into release 2015-01-14 10:34:10 -05:00
Stephen Kelly 23f3798c7b cmTarget: Compute link language of TARGET_OBJECTS with CMP0026 OLD (#15338)
Commit v3.1.0-rc1~297^2~5 (cmTarget: Drop 'head' argument from
GetSourceFiles, 2014-07-10) exposed a dormant bug in source file computation,
causing the test case to regress.  After that commit, the source file
computation and caching finds an existing container of source files.  Prior to
that patch, the GetSourceFiles method was called with either a null pointer
for the head cmTarget, or it was called with the this pointer.  The
processSources method is eventually called, which normalizes the difference
between the null pointer and the this pointer for the head target.  However,
the cache key depends on the actual pre-normalized pointer.  The change in
that commit caused the entry to be found in the cache where it was not before,
which resulted in incorrect behavior.

Prior to that commit, the test case also fails if the GetSourceFiles overload
taking a vector<cmSourceFile*> is changed to normalize the head target at
the beginning of the method:

  cmTarget const* head = head_ ? head_ : this;

Such a construct was correctly used in other locations where similar caching
was in place, before being removed in commit v3.1.0-rc1~310^2~25 (cmTarget:
Remove 'head' argument from GetLinkInformation, 2014-06-12), but is not
neccessary anymore.

Commit v3.1.0-rc1~674^2~2 (cmTarget: Cache the cmSourceFiles in
GetSourceFiles., 2014-04-05) introduced the caching, but fails the test case
for an unrelated reason.  That unrelated error was introduced in
commit v3.1.0-rc1~688^2~5 (cmTarget: Allow any generator expression in
SOURCES property., 2014-03-18) and fixed in
commit v3.1.0-rc1~561^2~1 (cmTarget: Fix listing of source files at
configure-time., 2014-04-13).

All commits which fail the test case in the testable way do so when such a
cached version of the source files is found and returned at generate
time.  In the test case, the cached content is populated at configure-time
through the use of the deprecated LOCATION property with CMP0026 OLD.  The
cached content is an empty container for the bar target in the test case,
because its source file 'foo.cpp.o' is not known until generate-time.  That
means that no source files are available to compute the link language and
the reported error is issued.

The actual problem is that the SourceFilesMap should be cleared after
configure time by cmTarget::ClearLinkMaps.  Clear it there now.
2015-01-13 09:36:20 +01:00
Brad King 1f41ec2ac2 Merge branch 'fix-autouic-regression' into release 2015-01-12 09:00:03 -05:00
Stephen Kelly 9a67373716 QtAutoUic: Add a test for the regression in the parent commit. 2015-01-12 01:41:27 +01:00
Brad King ca5fe169aa Merge branch 'fix-empty-target-property-queries' into release 2015-01-11 11:50:14 -05:00
Ben Boeckel c6d03a1072 tests: add tests for querying properties 2015-01-11 11:45:44 -05:00
Brad King 07fc7b75ef Tests: Test using objects from a language enabled in a subdirectory (#15325)
Add a test case that enables CXX in the top level and C in a subdirectory.
Create an executable in the top level that uses C objects compiled in the
subdirectory.  Strictly speaking this is not defined behavior for all
language combinations, but happens to work in this case.  Test this
behavior since projects might try to use it.
2014-12-22 20:13:40 -05:00
Brad King 1c104c019a Merge branch 'vs-phone-store-deployment-location' into release 2014-12-03 09:32:42 -05:00
Brad King 7c28e7c172 Merge branch 'vs-hlsl-settings' into release 2014-12-03 09:32:38 -05:00
Gilles Khouzam 352f246f3e VS: Add source file property to specify Windows App deployment location
Add a VS_DEPLOYMENT_LOCATION source file property to specify where to
put files that are part of the package.  For example:

  set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "assets")

Without this, sources marked with VS_DEPLOYMENT_CONTENT cannot be
located properly.
2014-12-03 09:31:59 -05:00
Cedric Perthuis 2a224b4ce3 VS: Add source file properties to set the hlsl shader entry point and model
Create properties VS_SHADER_ENTRYPOINT and VS_SHADER_MODEL.  Without
these many .hlsl source files may not be possible to use.  Extend the
VSWinStorePhone test project to cover them.
2014-12-03 09:30:59 -05:00
Brad King 58d3898083 Merge branch 'target-sources-error-conditions' into release 2014-12-01 08:55:45 -05:00
Stephen Kelly e134805666 Export: Disallow export of targets with INTERFACE_SOURCES
This can be allowed in the next release, but it needs to have some
features present and tested such as

* Ensuring that relative paths do not appear in the generated property.
* Ensuring that paths to the source or build directories do not appear.
* Generating a check in the file for CMake 3.1 or later so that the
    resulting property will be consumed.
* Ensuring that any referenced targets are part of an export set and
    generating a check for them.
* INSTALL_INTERFACE and BUILD_INTERFACE content.

All of these checks are already done for INTERFACE_INCLUDE_DIRECTORIES,
but it is too late to add them for INTERFACE_SOURCES for CMake 3.1.
As the checks introduce some new error conditions, it is better to
disallow exporting fully for this case and introduce proper error
conditions later instead of policies.
2014-11-29 12:24:59 +01:00
Stephen Kelly bb5905bb13 cmTarget: Don't allow relative paths in INTERFACE_SOURCES
Follow the pattern of checks that are made for INTERFACE_INCLUDE_DIRECTORIES.
Existence is already checked by cmSourceFile::GetFullPath.  Add a check
to disallow relative paths in source directories. Otherwise code such as

 target_sources(lib1 INTERFACE foo.cpp)

would fail if consumed by a target in a different directory.

Unlike the INTERFACE_INCLUDE_DIRECTORIES behavior, we don't care whether
the entry comes from an IMPORTED target or not.  In the include directories
case, the directory for a non-imported target might not exist yet but
might be created.  In the sources case, a file which does not yet
exist in the filesystem must be explicitly marked with the GENERATED
property.

Adjust existing tests and add a new test for the error.
2014-11-29 12:24:59 +01:00
Stephen Kelly 672f1001c0 Genex: Fix evaluation context propagation for TARGET_OBJECTS.
Extract a new method to encapsulate the requirements of evaluating
dependent-expressions, namely, propagation of the
EvaluateForBuildsystem setting, which is missing from the
getLinkedTargetsContent implementation.

Commit v3.1.0-rc1~688^2 (Genex: Only evaluate TARGET_OBJECTS to determine
target sources., 2014-03-20) introduced an error case for use of
TARGET_OBJECTS outside of the context of generating the buildsystem,
as the path to object files may be dependent on buildsystem
variables (See bug #15226).

Commit v3.1.0-rc1~314^2 (Allow INTERFACE_SOURCES to specify
$<TARGET_OBJECTS> (#14970), 2014-07-09) made it possible to
propagate such content to dependent targets.

While that commit propagated the EvaluateForBuildsystem setting
for the case of a TARGET_PROPERTY expression, as generated for
direct dependencies of a target in
cmTargetInternals::AddInterfaceEntries, it did not add propagation
for content from further transitive target dependencies, as determined
by getLinkedTargetsContent.
2014-11-26 22:16:15 +01:00
Brad King d2f2a2e226 Merge branch 'C-features-Wundef' into release 2014-11-26 10:33:54 -05:00
Stephen Kelly d0af0faefb WCDH: Make the header -Wundef safe for the C language.
The __STDC_VERSION__ macro may be defined or not depending on the
implementation dialect of C.  Test that it is defined before testing
its value.

The CXX tests do not need such a change because they define __cplusplus
in all dialects.
2014-11-25 14:44:21 +01:00
Stephen Kelly 36bb100e2b Fix the test for running the CxxDialog unit test.
The existing versions have been used since commit
v3.1.0-rc1~635^2~8 (cmTarget: Add CXX_STANDARD and CXX_EXTENSION
target properties., 2013-10-13), but further discussions since then
increased the initial minimum compiler versions this feature is
available for.
2014-11-20 22:10:25 +01:00
Stephen Kelly a3d0ae1758 Features: Fix the default C dialect for Clang and GNU.
Clang 3.4 uses C99 by default, and Clang 3.6 uses C11 by default:

 http://thread.gmane.org/gmane.comp.compilers.clang.devel/39379

GNU 4.9 uses C90 by default, and GNU 5.0 uses C11 by default:

 https://gcc.gnu.org/gcc-5/changes.html

Test that the default compiler settings result in the expected dialect
macros being defined for both C and CXX.  Remove the unused main.c
file from the CompileFeatures unit test.
2014-11-20 18:24:59 +01:00
Stephen Kelly 7565ab2cd1 Features: Test the CXX compiler only if it has features.
If using different C and CXX compilers, we might not have a
feature-full CXX compiler at this point.
2014-11-19 00:42:35 +01:00
Daniele E. Domenichelli 4db31095e5 Fix link line order when shared libraries are de-duplicated
Since commit v3.1.0-rc1~227^2~1 (De-duplicate shared library targets in
generated link lines, 2014-07-30) we de-duplicate shared library targets
on the link line.  However, some toolchains will fail linking if an
executable is linking to a shared library that is not used directly and
a static library that depends on the shared one.  The linker may not
keep the reference to the shared library the first time and then the
symbols needed by the static library may not be found.

Fix this by reversing the direction of the for loop that removes the
duplicate shared libraries, in order to ensure that the last occurrence
of the library is left instead of the first one.

Extend Tests/Dependency with a case covering this behavior.  Create an
executable that links to a shared library and a static library but only
needs the shared library as a dependency of the static library.

Co-Author: Brad King <brad.king@kitware.com>
2014-11-10 14:46:22 -05:00
Brad King 0c3ddf8b65 Merge branch 'revert-definition-map-lookup' into release 2014-10-24 13:38:32 -04:00
Ben Boeckel d1b62185d6 Merge branch 'parent-scope-tests' into variable-pull-failure
* parent-scope-tests:
  test: add a test for PARENT_SCOPE with multiple scopes
  test: add test for PARENT_SCOPE behavior

Conflicts:
	Tests/RunCMake/set/RunCMakeTest.cmake
2014-10-24 13:34:30 -04:00
Ben Boeckel e0c0b1ace5 test: add a test for PARENT_SCOPE with multiple scopes
See the comment in the test for what is being tested here.
2014-10-24 13:00:11 -04:00
Ben Boeckel 064c415d27 test: add test for PARENT_SCOPE behavior
Test code courtesy of Alex Merry <alex.merry@kde.org>.
2014-10-24 13:00:11 -04:00
Brad King ad984b60ed Tests/ExternalProject: Skip Windows hg tests with cygwin hg
The cygwin hg client is a text file with a '#!/bin/python" line.
This cannot run on Windows.
2014-10-22 10:52:28 -04:00
Brad King cea13d5536 Merge topic 'fix-ninja-rc-include-flags'
f4c5eade Ninja: Fix RC include directories regression
2014-10-13 08:21:04 -04:00
Brad King f4c5eade78 Ninja: Fix RC include directories regression
Changes in commit b9aa5041 (cmLocalGenerator: Simplify GetIncludeFlags
output formatting, 2014-03-04) caused Windows Resource Compiler include
directories to be computed as relative paths in the Ninja generator.
This breaks the cmcldeps handling of include paths.  The reason for the
regression is that several cmLocalGenerator::GetIncludeFlags callers
treated the fourth "bool forResponseFile" argument as if it controlled
whether include directories were a full path.  It actually did control
that by accident until the above commit.

Add an explicit "bool forceFullPaths" argument to GetIncludeFlags
and thread the value through ConvertToIncludeReference as needed.
Update GetIncludeFlags call sites that really wanted to control the
forResponseFile setting to be aware of the new argument.  Extend the
VSResource test to cover this case.
2014-10-13 08:20:05 -04:00
Brad King 26bffa6e74 Merge topic 'fix-OSX-bundle-rpaths-and-Qt5'
631fadea Help: Add notes for topic 'fix-OSX-bundle-rpaths-and-Qt5'
50e261dd OSX: Warn when attempting to change runtime paths on OS X 10.5
9b98fd52 cmake-gui: Make sure we bundle Qt5 Cocoa platform plugin
83a06bb4 BundleUtilities: Framework codesign Resources/Info.plist & Current
f7df82ac BundleUtilities: Resolve & replace @rpath placeholders
14bc686f GetPrerequisites: Make sure dyld placeholders are prefixes
6c313797 BundleUtilities: Use find on UNIX for fast executable lookup
2014-10-10 10:55:44 -04:00
Clinton Stimpson 50e261ddb6 OSX: Warn when attempting to change runtime paths on OS X 10.5
Even though 10.5 supports @rpath, the support is not complete
enough for CMake.  For instance, install_name_tool doesn't support
adding and removing rpaths.

Also modifying BundleUtilities test to remove an undesirable cmake
generated runtime path.  The intent was to build with the install
rpath as is done with the other cases in this test.
2014-10-10 10:17:27 -04:00
Brad King b3cbb9e188 Merge topic 'FPHSA_exact_version'
ba907f7d FPHSA: fix when requested or found version is exactly 0
4f9bf446 FPHSA: when EXACT version match is requested only compare the components given
2014-10-08 10:48:14 -04:00
Brad King ec941fc04b Merge topic 'ctest-memcheck-sanitizers'
e0e75a72 Help: Add notes for topic 'ctest-memcheck-sanitizers'
7345a1f7 tests: Add a test for ctest_memcheck MemorySanitizer
0c6330da ctest_memcheck: Add support for MemorySanitizer msan
9ba8bf12 tests: add a test for ctest_memcheck UndefinedBehaviorSanitizer
816c100a ctest_memcheck: Add support for UndefinedBehaviorSanitizer ubsan
b67ef537 ctest_memcheck: Order sanitizer type code consistently
f48a2968 Tests: Organize CTestTestMemcheck inner test code
2014-10-08 10:48:12 -04:00
Rolf Eike Beer ba907f7dc2 FPHSA: fix when requested or found version is exactly 0
Until now it was checked with "if(VAR)", which will be false in case "0" is the
content of the variable.
2014-10-07 23:14:46 +02:00
Rolf Eike Beer 4f9bf4468b FPHSA: when EXACT version match is requested only compare the components given
Given that you have a foobar that identifies itself as 1.2.3 from now on a

  find_package(foobar 1.2 EXACT)

will succeed, as 1.2.3 will now be considered as being 1.2. Until now this was
only the case for version 1.2.0.
2014-10-07 23:14:45 +02:00
Bill Hoffman 7345a1f71d tests: Add a test for ctest_memcheck MemorySanitizer 2014-10-07 15:27:34 -04:00
Ben Boeckel 9ba8bf123c tests: add a test for ctest_memcheck UndefinedBehaviorSanitizer 2014-10-07 15:27:34 -04:00
Brad King f48a2968aa Tests: Organize CTestTestMemcheck inner test code
Update some whitespace and add comment dividers.
2014-10-07 15:27:33 -04:00
Brad King fa56eb56b9 Merge topic 'ctest-memcheck-sanitizers'
f25e431d tests: set sanitizer options properly
f0661bf3 tests: fix copy/paste from tsan -> asan comments
ca9cc25c ctest: add support for additional sanitizer options
0b9ffffc ctest: update documentation for CTEST_MEMORYCHECK_TYPE
2014-10-07 14:45:26 -04:00
Ben Boeckel f25e431d6e tests: set sanitizer options properly
Prior to this, these options were just being set in the environment.
2014-10-06 15:28:45 -04:00
Ben Boeckel f0661bf318 tests: fix copy/paste from tsan -> asan comments 2014-10-06 15:28:45 -04:00
Brad King d2562e2353 Merge topic 'vs-intel-15'
a128129a VS: Support Intel Fortran 15 .vfproj generation (#15175)
2014-10-03 15:10:10 -04:00
Brad King 34d035e70e Merge topic 'vs-nsight-tegra-generator'
df84281d Help: Add notes for topic 'vs-nsight-tegra-generator'
69e198dc VS: Generate Nsight Tegra project revision number
5365c9ac VS: Map Nsight Tegra file types in .vcxproj files
178f56a5 VS: Fix Tegra-Android platform linking of libraries by name
7115702f Tests: Add test for VS Nsight Tegra generator support
a6289499 VS: Generate ANDROID_GUI executables as app packages
c12e4699 Add 'ANDROID_API' target property to set Android Target API
9a4df52a Add 'ANDROID_GUI' target property to mark Android applications
16569abf cmTarget: Track internally whether platform is Android
ef0fd4f0 VS: Teach vcxproj generation about the Tegra-Android platform
d09b60f5 VS: Detect compiler id of Nsight Tegra-Android toolchains
2f071466 VS: Teach VS >= 10 to recognize CMAKE_SYSTEM_NAME 'Android'
2014-09-30 08:46:27 -04:00
Brad King 178f56a579 VS: Fix Tegra-Android platform linking of libraries by name
Nsight Tegra Visual Studio Edition handles prefixing of library names
with '-l' automatically, so teach the generator not to do so.

Reported-by: Mourad Boufarguine <mourad@boufarguine.name>
2014-09-30 08:45:35 -04:00
Brad King 7115702f1b Tests: Add test for VS Nsight Tegra generator support
Create a VSNsightTegra test based on the "two-libs" example from the
Android NDK.  Add it whenever testing on a machine with VS 11 or 12
and the NVIDIA Nsight Tegra Visual Studio Edition installed.  Exclude
it when there is a space in the path to the source or build tree because
the tools do not seem to support it.
2014-09-30 08:45:34 -04:00
Brad King a128129a86 VS: Support Intel Fortran 15 .vfproj generation (#15175)
This version of the Intel Fortran plugin to Visual Studio says:

 please make sure that $(OutDir), $(TargetName) and $(TargetExt)
 property values match the value specified in %(Link.OutputFile)

We must set TargetName and TargetExt in addition to the existing
setting for OutputDirectory.  The settings do not appear to hurt
older versions of Intel Fortran, so set them unconditionally.

Extend the FortranOnly test to cover a corresponding use case by
using the OUTPUT_NAME target property.

Inspired-by: Ian Harvey <Ian.Harvey@megms.com.au>
2014-09-30 08:24:50 -04:00
Brad King cb9e86706c Merge topic 'vs-minor-cleanups'
c655f0c4 VS: Drop GenerateManifest from .vcxproj files for non-MS tools
227a3367 VS: Use case-insensitive check for hlsl,jpg,png,xml file extensions
4a24015a Tests: Always detect VS and SDK availability on Windows
2014-09-29 16:26:07 -04:00
Brad King 4a24015afc Tests: Always detect VS and SDK availability on Windows
Move the detection block out of the Windows >= 8 conditional so it
can be used on other versions.
2014-09-29 16:05:52 -04:00
Tony Kelman e0acdd1a47 Tests: Adjust expected error message in FailedSubmit-ftp
Error message from cygwin's curl (using `--system-libs`) in
CTestTestFailedSubmit-ftp was:

  Failed to connect to  port 21: Connection timed out
        ^^^

Update our regex to match this.
2014-09-26 08:34:14 -04:00