Commit Graph

4248 Commits

Author SHA1 Message Date
Brad King a66004bee0 Honor CMAKE_<LANG>_FLAGS[_<CONFIG>]_INIT set in toolchain files
Document these variables.

Change our convention for setting these variables from:

    set(CMAKE_C_FLAGS_INIT "...")

to

    string(APPEND CMAKE_C_FLAGS_INIT " ...")

so that any value previously set by a toolchain file will be used.

Automate the conversion with:

    sed -i 's/set *(\(CMAKE_\(C\|CXX\|Fortran\|RC\|ASM\|${[^}]\+}\)_FLAGS\(_[^_]\+\)\?_INIT \+"\)/string(APPEND \1 /' \
      Modules/Compiler/*.cmake Modules/Platform/*.cmake

and follow up with some manual fixes (e.g. to cases that already
meant to append).  Also revert the automated changes to contexts
that are not protected from running multiple times.
2016-07-06 10:13:31 -04:00
Brad King d582c23a47 try_compile: Add policy CMP0066 to honor CMAKE_<LANG>_FLAGS_<CONFIG>
In the `try_compile` source file signature we propagate the caller's
value of `CMAKE_<LANG>_FLAGS` into the test project.  Extend this to
propagate `CMAKE_<LANG>_FLAGS_<CONFIG>` too instead of always using the
default value in the test project.  This will be useful, for example, to
allow the MSVC runtime library to be changed (e.g. `-MDd` => `-MTd`).
However, some projects may currently depend on this not being done,
so we need to activate the behavior using a policy.

This change was originally made by commit v3.6.0-rc1~160^2 (try_compile:
Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes, 2016-04-11) but without the
policy and so had to be reverted during the 3.6 release candidate cycle.

Fixes #16174.
2016-06-29 09:11:02 -04:00
Brad King 8d79375818 Merge topic 'GenerateExportHeader-custom-content'
a9252441 Tests: Run clang-format on GenerateExportHeader code
2016-06-29 09:10:29 -04:00
Brad King a9252441b3 Tests: Run clang-format on GenerateExportHeader code 2016-06-29 09:09:54 -04:00
Brad King cb93dc048f Merge topic 'GenerateExportHeader-custom-content'
843402b0 GenerateExportHeader: Add option to specify custom content
2016-06-29 09:07:33 -04:00
Brad King db4ba61f39 Merge topic 'revert-try_compile-config-flags'
943fe6e3 Revert "try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes"
2016-06-29 09:07:28 -04:00
Brad King 943fe6e3b4 Revert "try_compile: Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes"
Revert commit v3.6.0-rc1~160^2 (try_compile: Honor
CMAKE_<LANG>_FLAGS_<CONFIG> changes, 2016-04-11).  The behavior it
introduced can break projects that depend on the lack of such behavior.
We will have to introduce a policy or other mechanism to enable the
behavior in a compatible way.  Simply revert it for now.

See issue #16174.
2016-06-28 15:03:45 -04:00
Brad King 843402b04a GenerateExportHeader: Add option to specify custom content 2016-06-28 09:43:52 -04:00
Brad King 1b021a64f8 Merge topic 'ninja-no-rsp-for-rc'
15b3f6f0 ninja, rc: ignore CMAKE_NINJA_FORCE_RESPONSE_FILE for RC files
2016-06-28 09:06:34 -04:00
Ben Boeckel 15b3f6f0f1 ninja, rc: ignore CMAKE_NINJA_FORCE_RESPONSE_FILE for RC files
In commit v3.6.0-rc1~174^2 (Ninja: Honor CMAKE_NINJA_FORCE_RESPONSE_FILE
for compile rules, 2016-04-06), Ninja learned to look for
`CMAKE_NINJA_FORCE_RESPONSE_FILE` in the current scope or the
environment in order to force response file usage for all compilation
rules.

However, on Windows, the RC compiler goes through cmcldeps which does a
`replace(output, output + ".dep.obj")` on the command line. However,
with a response file (which we name `output + ".rsp"`), the response
file path is replaced instead causing the compiler to (correctly)
complain that the response file `output + ".dep.obj.rsp"` does not
exist.

What needs to happen is for cmcldeps to look through the response file,
replace *its* contents and place it in the `output + ".dep.obj.rsp"`
file.

Also add a test which actually compiles an RC file into a library and
executable for all generators on Windows and additionally test
`CMAKE_NINJA_FORCE_RESPONSE_FILE` for Ninja generators.

Fixes #16167.
2016-06-27 14:34:06 -04:00
Brad King c2c2a2f4c7 Merge topic 'vs-tool-override'
ed05f11d VS: Add a VS_TOOL_OVERRIDE source file property
2016-06-23 08:59:29 -04:00
Brad King 015876fa81 Merge topic 'vs-sdk-refs'
35a6cac2 VS: Add VS_SDK_REFERENCES target property to reference external SDKs
2016-06-23 08:59:26 -04:00
Brad King f101d4eff3 Merge topic 'xcode-bundle-extension'
e36e5a26 Xcode: Properly handle BUNDLE_EXTENSION
2016-06-23 08:59:23 -04:00
Gilles Khouzam 35a6cac2d3 VS: Add VS_SDK_REFERENCES target property to reference external SDKs
Allow one to specify external SDK references such as
`Microsoft.AdMediatorWindows81, Version=1.0`.
2016-06-22 08:34:12 -04:00
Gilles Khouzam ed05f11dd2 VS: Add a VS_TOOL_OVERRIDE source file property
This property allow to specify a specific Visual Studio tool for a
source file overriding the default tool behavior.  For example, a
`.resw` file being processed as a `PriResource` file.  This has the
advantage of being able to teach CMake to process new file types without
code modifications.
2016-06-20 10:46:14 -04:00
Brad King 74fde78311 Merge topic 'cmake-trace-source'
e63151ff cmake: Add an option to control what files needs to be traced
2016-06-20 09:56:06 -04:00
Brad King e2d700bd97 Merge topic 'cpack-deb-test-fixes'
6107fab4 CPack/Deb: Fix test to actually test the preinst script
302391ba CPack/Deb: Fix tests for SELinux-enabled systems
2016-06-20 09:56:01 -04:00
Domen Vrankar 6107fab467 CPack/Deb: Fix test to actually test the preinst script
The test regex variable name was invalid and did not test preinst
script.

Reported-by: Patrick <mail6543210@yahoo.com.tw>
2016-06-20 09:29:11 -04:00
Domen Vrankar 302391bae6 CPack/Deb: Fix tests for SELinux-enabled systems
Suggested-by: Patrick <mail6543210@yahoo.com.tw>
2016-06-20 09:29:11 -04:00
Gregor Jasny e36e5a2680 Xcode: Properly handle BUNDLE_EXTENSION 2016-06-18 23:23:32 +02:00
Alex Turbov e63151ff54 cmake: Add an option to control what files needs to be traced
Even in relatively small projects using `--trace` (and `--trace-expand`)
may produce a lot of output.  When developing a custom module usually
one is interested in output of only a few particular modules.

Add a `--trace-source=<file>` option to enable tracing only a subset of
source files.  The final output would be only from requested modules,
ignoring anything else not matched to given filename(s).
2016-06-17 11:46:23 -04:00
Brad King e4cb7d7609 Merge topic 'link_what_you_use'
a0902efa Help: Add notes for topic 'link_what_you_use'
96242f80 Add options to run `ldd -u -r` as a "link-what-you-use" tool
2016-06-17 11:06:44 -04:00
Bill Hoffman 96242f8022 Add options to run `ldd -u -r` as a "link-what-you-use" tool
Create a LINK_WHAT_YOU_USE target property and corresponding
CMAKE_LINK_WHAT_YOU_USE variable to enable this behavior.
Extend link commands by running `ldd -u -r` to detect shared
libraries that are linked but not needed.
2016-06-17 10:56:40 -04:00
Brad King 0e523d0612 Merge topic 'cleanup-streams'
ed5fa48d cmXMLWriter: use ifstream from KWSys
24ab29b8 Prefer istringstream and ostringstream over stringstream.
ab8b77dd Remove redundant arguments from fstream constructors
eb79fa72 Access std::ios_base with std::ios
2016-06-16 09:46:54 -04:00
Daniel Pfeifer ab8b77dd33 Remove redundant arguments from fstream constructors
Don't pass the default value of the openmode parameter explicitly.
2016-06-14 22:28:55 +02:00
Stephen Kelly 0a9094cd10 Parser: Issue file open error messages through dedicated API 2016-06-13 20:19:16 +02:00
Brad King 3b14a4bca4 Merge topic 'fix-Message-API-ISP-violation'
0a4af073 cmake: Issue message independent of cmMakefile definition
2016-06-13 09:54:20 -04:00
Brad King 941fbe31f5 Merge topic 'find-lib32'
896ad251 Teach find_library and find_package to search lib32 paths (#11260)
2016-06-13 09:54:17 -04:00
Stephen Kelly 0a4af0735f cmake: Issue message independent of cmMakefile definition
The makefile is only used when called by the cmMessageCommand, so inline
the use of it there.  It otherwise creates an undesirable dependency on
cmMakefile for issuing messages in the cmake instance, a violation of
the Interface Segregation Principle.

 https://en.wikipedia.org/wiki/Interface_segregation_principle

This also makes it more explicit that the variable definitions only
affect the message() command.  If an AUTHOR_WARNING is issued for any
other reason, it is not affected.  To affect that, it is necessary to
set the cache variable instead of the regular variable.

This is an unfortunate interface quirk, but one which can't be fixed
easily now.
2016-06-12 18:38:33 +02:00
Daniel Pfeifer a16bf141bc Add missing braces around statements.
Apply fixits of clang-tidy's readability-braces-around-statements
checker.
2016-06-10 18:36:24 +02:00
Daniel Pfeifer bd9e551c1a PseudoMemcheck: revise style with clang-format.
Rename memtester.cxx.in to memtester.cxx, run clang-format, then restore
the original name.  Fix the @_retval@ placeholder that was broken by
clang-format.
2016-06-10 18:31:30 +02:00
Daniel Scharrer 896ad251de Teach find_library and find_package to search lib32 paths (#11260)
Add a ``FIND_LIBRARY_USE_LIB32_PATHS`` global property analogous to the
``FIND_LIBRARY_USE_LIB64_PATHS`` property.  This helps find commands on
multilib systems that use ``lib32`` directories and either do not have
``lib`` symlinks or point ``lib`` to ``lib64``.
2016-06-10 11:09:16 -04:00
Brad King 5d078868f0 Merge topic 'watcom-workaround'
ceebac93 Tests: Restore fix to Plugin test on Watcom compiler
2016-06-10 09:09:50 -04:00
Brad King 5aa89a1ae0 Merge topic 'java-export-targets'
0bd91ad4 UseJava: Fix race condition creating java class list
89df91b9 Help: Add notes for topic 'java-export-targets'
95d84369 Tests: Add test for exported JARs
5341c0d8 UseJava: Add infrastructure to export targets
d91ec044 Tests/Java: Clean up style of Java test code
2016-06-09 09:18:17 -04:00
Brad King ceebac93f6 Tests: Restore fix to Plugin test on Watcom compiler
The fix in commit v3.4.0-rc1~127^2 (Tests: Fix Plugin test on Watcom
compiler, 2015-09-03) was reverted accidentally by automated .c_str()
removal.  Restore it and add a comment explaining why.
2016-06-09 09:11:10 -04:00
Brad King ba92e11f8b Merge topic 'add-FindVulkan'
b8a00b67 Tests/FindVulkan: Run clang-format
2016-06-08 12:57:44 -04:00
Brad King b8a00b6721 Tests/FindVulkan: Run clang-format 2016-06-08 12:56:50 -04:00
Brad King fb8b8dd106 Merge topic 'add-FindVulkan'
adf4df28 Add FindVulkan.cmake.
2016-06-08 12:56:07 -04:00
Brad King 8632251b25 Merge topic 'find_path-in-framework'
188baef0 find_path: Fix location of <dir/header.h> in a framework on OS X
2016-06-08 12:56:00 -04:00
Matthäus G. Chajdas adf4df28ca Add FindVulkan.cmake.
This adds FindVulkan with corresponding tests.
2016-06-08 12:44:03 -04:00
Harry Mallon 188baef00c find_path: Fix location of <dir/header.h> in a framework on OS X
After finding it in `foo.Framework/Headers/dir/header.h`, we should
report the `foo.Framework/Headers` directory, not
`foo.Framework/Headers/dir`, because the former is what actually
contains the path the caller wishes to include.
2016-06-07 09:04:35 -04:00
Matthew Woehlke 95d84369b8 Tests: Add test for exported JARs
Add a unit test to test the new functions to export JAR targets. The
test builds three sub-projects: two that generate and export a JAR (one
does a build-directory-only export, one an install-only export), and a
third that consumes the first two as imported targets.
2016-06-07 08:50:36 -04:00
Matthew Woehlke d91ec04402 Tests/Java: Clean up style of Java test code 2016-06-07 08:50:35 -04:00
Brad King 3b2844328c Tests/FindOpenCL: Run clang-format to fix style 2016-06-07 08:41:06 -04:00
Daniel Pfeifer fa277b29e4 Remove c_str() calls from stream arguments.
Mostly automated:

git grep -l '.c_str() <<' | xargs sed -i 's|\.c_str() <<| <<|g'
2016-06-06 23:53:32 +02:00
Brad King d546456765 Merge topic 'productbuild'
63e5eb5f Help: Add notes for 'productbuild' topic
2e3c67d1 productbuild: Add new productbuild cpack generator.
50a3d340 PackageMaker: factor out common code for creating pkg files.
2016-06-06 11:19:20 -04:00
Clinton Stimpson 2e3c67d1b6 productbuild: Add new productbuild cpack generator.
This cpack generator basically replaces the obsolete PackageMaker generator.
2016-06-03 14:41:57 -06:00
Brad King 9d16f64048 Merge topic 'fix-TARGET_PROPERTY-LOCATION-crash'
f500a784 Fix crash on $<TARGET_PROPERTY:...,LOCATION> genex (#16134)
2016-06-03 10:45:57 -04:00
Brad King f500a784d0 Fix crash on $<TARGET_PROPERTY:...,LOCATION> genex (#16134)
Policy CMP0026 deprecated the LOCATION property, and we have long
provided a $<TARGET_FILE:...> generator expression.  However, if
a project tries to use $<TARGET_PROPERTY:...,LOCATION> we should
at least not crash.

The compatibility implementation of the LOCATION property uses
cmGlobalGenerator::CreateGenerationObjects to create the structures
needed to evaluate the property before generation starts.  The
implementation assumed that accessing the property could only be done
during configuration (via the typical get_property command use case).
The $<TARGET_PROPERTY:...,LOCATION> genex causes the LOCATION property
to be accessed during generation.  Calling CreateGenerationObjects
during generation blows away all the objects currently being used for
generation and is not safe.  Add a condition to call it only when
configuration is not finished.
2016-06-02 10:58:38 -04:00
Matthäus G. Chajdas b66d4739b5 FindOpenCL: Add an imported target 2016-06-02 08:46:43 -04:00