Commit Graph

157 Commits

Author SHA1 Message Date
Ilya Kulakov 79410eeb1f ExternalProject: Initialize Git submodules recursively and on update (#16083) 2016-05-03 10:04:37 -04:00
Brad King 7db9f3f294 ExternalProject: Add option to perform a shallow Git clone (#15291)
Inspired-by: Ilya Kulakov <kulakov.ilya@gmail.com>
2016-04-27 10:58:07 -04:00
Brad King 4d8c988caa ExternalProject: Fix file download script with CMAKE_TLS_{VERIFY,CAINFO}
Avoid generating incorrect code such as

    set(CMAKE_TLS_VERIFY set(CMAKE_TLS_VERIFY 1))

when one of these variables is set in the calling project.
2016-04-06 16:49:13 -04:00
Brad King 23a71e4e4d ExternalProject: Tell Git not to verify certs only if TLS_VERIFY is OFF
Since commit 272779ce (ExternalProject: Allow TLS_VERIFY for git clones,
2016-04-01) we pass the `-c http.sslVerify=false` option to `git clone`
even if no explicit `TLS_VERIFY` option was set.  This changes behavior
because we used to use the default Git behavior by default.  Revise the
logic to preserve the old default behavior by passing the new option
only if `TLS_VERIFY` was explicitly passed as `OFF`.

While at it, also honor `CMAKE_TLS_VERIFY` if the explicit `TLS_VERIFY`
option is not given.
2016-04-06 16:49:13 -04:00
Samir Benmendil 272779ce6a ExternalProject: Allow TLS_VERIFY for git clones
Use the git config `http.sslVerify=false` to disable strict ssl for git
commands.
2016-04-01 11:49:16 -04:00
Brad King 0aa736e625 Merge topic 'fix-spelling-typos'
49e82c15 Fix spelling typos in comments and documentation (#16037)
2016-03-31 08:46:03 -04:00
Ben Boeckel 1ba9b53547 ExternalProject: add support for just downloading a file
Some projects only ship self-extracting installers rather than
compressed archives. Add a flag so that these files may be used in
ExternalProject.
2016-03-31 08:37:12 -04:00
Felix Geyer 49e82c15d5 Fix spelling typos in comments and documentation (#16037)
The Debian package checker tool (lintian) detected several typos in
CMake.
2016-03-29 14:31:02 -04:00
Brad King 1b9d15c1e7 ExternalProject: Be compatible with projects setting CMAKE_CFG_INTDIR
Since commit v3.5.0-rc1~32^2~1 (ExternalProject: Simplify `cmake
--build` configuration passing, 2016-01-19) we use the `$<CONFIG>`
generator expression to generate the `cmake --build . --config <config>`
value for the default BUILD_COMMAND instead of the CMAKE_CFG_INTDIR
placeholder value provided by multi-config generators.  However, some
projects have been abusing the old implementation detail by setting
CMAKE_CFG_INTDIR themselves to get a specific configuration.  Those
projects should be updated to set their own BUILD_COMMAND to get
non-default behavior.  Meanwhile we can be compatible with their
existing releases by detecting when CMAKE_CFG_INTDIR is not a
generator-provided placeholder and using its value instead.
2016-02-05 14:43:16 -05:00
Brad King ec00e89e83 ExternalProject: Fix TEST_BEFORE_INSTALL for multi-config generators
In multi-config generators we must tell `ctest` what configuration to
test.

Reported-by: Taylor Braun-Jones <taylor@braun-jones.org>
2016-01-20 08:36:30 -05:00
Brad King 5d739a3c84 ExternalProject: Simplify `cmake --build` configuration passing
Check CMAKE_CONFIGURATION_TYPES instead of CMAKE_CFG_INTDIR in order
to recognize multi-config generators.  Then use $<CONFIG> to pass
the configuration value.
2016-01-20 08:36:09 -05:00
Adam Rankin 83d633919a ExternalProject: Add option to set `git clone -o` argument
Add a `GIT_REMOTE_NAME` option to `ExternalProject_Add` to support

  git clone --origin <name>

Default to `origin` if not specified.
2016-01-15 14:20:04 -05:00
Brad King c9e0173e6f ExternalProject: Always use CMake builtin FindGit (#15791)
Unset CMAKE_MODULE_PATH before calling find_package(Git) to ensure we do
not get a project-provided FindGit module that may not provide the
GIT_VERSION_STRING that we need.  We do not need to restore the value
explicitly because this occurs inside the _ep_add_download_command
function call scope.
2015-10-15 09:35:43 -04:00
Brad King 4cd52dc551 ExternalProject: Fix Git version report in error message (#15791)
Refactoring in commit v3.4.0-rc1~77^2~1 (ExternalProject: Use
GIT_VERSION_STRING instead of custom method, 2015-09-17) forgot
to update the variable name used in an error message.
2015-10-15 09:00:23 -04:00
Daniele E. Domenichelli 7c5b6ed5c8 ExternalProject: Use "git stash save --all" only if supported (#15722)
The --all option for git-stash wasn't introduced until git version 1.7.6.
2015-09-17 12:05:07 +02:00
Daniele E. Domenichelli b04c38159e ExternalProject: Use GIT_VERSION_STRING instead of custom method
GIT_VERSION_STRING is available in FindGit.cmake since CMake version 2.8.8
2015-09-17 11:47:26 +02:00
A. Joël Lamotte 6a77a77a62 ExternalProject: Tell "hg clone" not to implicitly update
By default Mercurial command "clone" will implicitly call "update" with
the "default" branch after downloading the cloned repository.  However
ExternalProject_Add() always generates a second "update" command after
cloning with a tag which is either specified or "tip" (equivalent to
"default" by default).  Therefore ExternalProject will first clone then
update to default branch then update to another specified branch if
provided.  This leads to potentially very long clone operation (in
particular when the repository default branch contain subrepos) which
can lead to transaction abort triggered by the server.

Simply use "hg clone -U" to avoid the implicit update during clone.
Our following call to "hg update" will take care of updating anyway.
2015-08-11 09:25:31 -04:00
Matt McCormick 623dcc85a4 ExternalProject: Avoid if() auto-dereference of a "TEST" variable
Exposed by CMP0054 warnings.
2015-08-03 09:21:39 -04:00
James Johnston e494763997 ExternalProject: Added new USES_TERMINAL options
Added new USES_TERMINAL option to the ExternalProject_Add_Step
function.  This option passes USES_TERMINAL to the underlying
add_custom_command call so that the Ninja console pool is used.
Also, corresponding new USES_TERMINAL_<step> options were added
to the ExternalProject_Add function.

Justification: if using Ninja with a CMake superbuild, it's often
desirable to limit the superbuild to ONE sub-Ninja process at a
time to avoid oversubscribing the CPU.  Using the console pool also
makes it easy to monitor the progress of the sub-Ninja process.

Independent USES_TERMINAL_<step> arguments are passed to
ExternalProject_Add instead of one USES_TERMINAL argument that
controls everything.  Users may wish to run some steps in parallel
but not others (e.g. parallelize configure but not build).
2015-07-06 14:51:40 -04:00
Silvio Traversaro 14e2c3ad18 ExternalProject: Initialize only selected git submodules (#15590)
Honor the GIT_SUBMODULES option added by commit v3.0.0-rc1~92^2
(ExternalProject: Add option GIT_SUBMODULES, 2014-01-09) during the
'git submodule init' step to avoid initalizing all modules since we
are only going to update the specified subset anyway.  This will
be useful for project repositories that have many submodules
(e.g. https://github.com/boostorg/boost).

Reviewed-by: Daniele E. Domenichelli <daniele.domenichelli@iit.it>
2015-06-02 14:31:26 -04:00
Daniele E. Domenichelli a0d620de82 ExternalProject: Fix log when the first arg of commands is "COMMAND" (#15567) 2015-05-20 15:43:15 +02: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 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
Brad King c0502faa4b ExternalProject: Fix error message typo 2015-04-21 11:32:13 -04:00
Andrey Pokrovskiy 0273ef1469 ExternalProject: Allow generator expressions with LOG_* options (#15287)
Use file(GENERATE) to write the logging wrapper scripts to evaluate
generator expressions.  Use a per-config script names in case the
content varies by configuration.
2015-04-21 10:51:08 -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
Ben Boeckel a704098de8 ExternalProject: fix the build command for generator overrides
The `binary_dir` variable is never set, so this is invalid. Instead, use
"." which all the other build commands use anyways. Also only set the
--config option if it is meaningful.
2015-03-26 18:12:04 -04:00
Gaëtan Lehmann 86032ae0eb ExternalProject: Replace placeholder tokens in BYPRODUCTS
This allows the developer to specify the byproducts relative to the
binary directory without the need to set the binary directory location
explicitly.
2015-03-09 10:04:44 -04:00
Daniele E. Domenichelli a7631fc4e0 Modules: Check for ARGC before using ARGV#
ARGV# could be defined from a parent scope.
2015-02-27 10:59:23 -05:00
Brad King a4605973ff ExternalProject: Allow ALWAYS step property to be switched (#15368)
Within an existing build tree, if the stamp for a step already exists
when one activates the ALWAYS option, we still want it to always build.
Remove the step stamp file during CMake configuration to ensure it does
not exist when the ALWAYS option is enabled.
2015-01-23 13:38:59 -05:00
Brad King 1b3ab3318d Merge topic 'cmp0054-warnings-extproj'
a300d0ff ExternalProject: avoid CMP0054 warnings
2014-12-15 11:06:57 -05:00
Ben Boeckel 480e60298f ExternalProject: remove extra newlines from log messages
message() already adds a newline.
2014-12-12 18:42:33 -05:00
Ben Boeckel a300d0ff0f ExternalProject: avoid CMP0054 warnings
Found where ${command} is "make" which is a local variable.
2014-12-12 18:30:00 -05:00
Daniele E. Domenichelli 636f0c1d4f ExternalProject: Add TEST_EXCLUDE_FROM_MAIN option
If this option is enabled, the test step is created with the
EXCLUDE_FROM_MAIN option, and if TEST_BEFORE_INSTALL is enabled, the
install step does not depend on the test step.

This means that the test step is never executed, unless the test target
is explicitly created by calling ExternalProject_Add_StepTarget, or by
passing it with the STEP_TARGETS option, or with the EP_STEP_TARGETS
directory property.
2014-12-05 10:24:16 +01:00
Brad King 557aef0b94 ExternalProject: Add options to specify BYPRODUCTS (#14963)
The external project's build process may generate byproducts on which
other rules in the driving project's build later depend.  Provide a way
for the driving project to specify what byproducts it expects to be made
available by the custom commands that drive the external project.
2014-11-17 09:36:42 -05:00
Brad King 2c71fe6d62 Merge topic 'ExternalProject_UPDATE_DISCONNECTED'
3c497f11 Help: Add notes for topic 'ExternalProject_UPDATE_DISCONNECTED'
aba5cec6 ExternalProject: Add unit tests for UPDATE_DISCONNECTED
3f606fa7 ExternalProject: Add UPDATE_DISCONNECTED option
c0b749cf ExternalProject: Always add a command to a step
2014-11-13 10:08:22 -05:00
Brad King 8049114bac Merge topic 'ExternalProject-check-hash-before-download'
ee7405a6 ExternalProject: Restore logic to not download already-existing file
2014-11-11 12:45:57 -05:00
Brad King ee7405a6db ExternalProject: Restore logic to not download already-existing file
The change in commit v3.1.0-rc1~85^2 (ExternalProject: Fix download
retry logic, 2014-09-13) dropped the file(DOWNLOAD) EXPECTED_HASH
argument.  This prevents file(DOWNLOAD) from skipping the download if
the output file already exists with the proper hash.  Restore this check
with explicit code in the download script.

Reported-by: Ruslan Baratov <ruslan_baratov@yahoo.com>
2014-11-10 11:26:52 -05:00
Daniele E. Domenichelli 3f606fa7d0 ExternalProject: Add UPDATE_DISCONNECTED option
If UPDATE_DISCONNECTED is set, the update step is not executed
automatically when building the main target. The update step can still
be added as a step target and called manually. This is useful if you
want to allow to build the project when you are disconnected from the
network (you might still need the network for the download step).
This is disabled by default.

The directory property EP_UPDATE_DISCONNECTED can be used to change
the default value for all the external projects in the current
directory and its subdirectories.
2014-11-06 15:09:43 +01:00
Daniele E. Domenichelli c0b749cf62 ExternalProject: Always add a command to a step
Some generators (i.e. Xcode) will not generate a file level target if
no command is set, and therefore the dependencies on this target will
be broken.
This patch sets an empty echo command that does nothing to avoid this
issue.
2014-11-06 15:09:43 +01:00
Daniele E. Domenichelli f598f1aa83 ExternalProject: Add ExternalProject_Add_StepDependencies function
The ExternalProject_Add_StepDependencies function add some dependencies
for some external project step.

The syntax is:
 ExternalProject_Add_Step_Dependencies(<name> <step> [target1 [target2 [...]]])

This function takes care to set both target and file level dependencies,
and will ensure that parallel builds will not break.

It should be used instead of add_dependencies() when adding a dependency
for some of the step targets generated by ExternalProject. See also:
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/8680/focus=8926
2014-11-03 16:15:14 +01:00
Daniele E. Domenichelli 4ae133e09c ExternalProject: Add independent step targets
When adding step targets using ExternalProject_Add_StepTargets, the
STEP_TARGETS argument or the EP_STEP_TARGETS property, ExternalProject
sets all the dependencies for the main project to that target.  Due to
this, the update target cannot be used without downloading and building
all the dependencies.

In order to be able to add step targets that do not depend on other
external projects, this patch adds:

* An optional "NO_DEPENDS" argument to the
  ExternalProject_Add_StepTargets function. If this argument is set,
  then no dependencies are set for the target (file dependencies will
  still be set).

* A new argument INDEPENDENT_STEP_TARGETS to the ExternalProject_Add
  function and a new directory property EP_INDEPENDENT_STEP_TARGETS that
  behave like STEP_TARGETS and EP_STEP_TARGETS, but cause the
  ExternalProject_Add_StepTargets to be called with the NO_DEPENDS
  argument.
2014-11-03 16:15:14 +01:00
Daniele E. Domenichelli 98cdb658e4 ExternalProject: Add CMAKE_CACHE_DEFAULT_ARGS arguments
This argument allows to set default arguments that are written in the
initial cache file, but that are not forced, and therefore allows the
user to change these values later (CMAKE_ARGS and CMAKE_CACHE_ARGS
always overwrite the values).

Also add some documentation to explain the differences between these 3
arguments.

Extend ExternalProjectLocal test to cover CMAKE_CACHE_DEFAULT_ARGS.
2014-10-31 11:34:04 -04:00
Brad King d9c2c17b29 ExternalProject: Use explicit markup and definition lists in docs
Convert ExternalProject module documentation to use explicit markup
blocks for each command.  Enumerate command options with definition
lists instead of a literal block.  This will allow more detail to be
added later.  Also fix the logic that parses options out of the
documentation to be aware of the new layout.
2014-10-28 12:46:17 -04:00
Brad King 98936ae3e0 ExternalProject: Convert docs to a bracket comment
Use a bracket comment to hold the documentation instead of a block of
line comments.  This will make further updates easier.  Also fix the
logic that parses options out of the documentation to be aware of the
new layout.
2014-10-28 12:41:00 -04:00
Brad King f28ebcbf1b Merge topic 'cleanup-CMP0054'
fa7d47ac Tests: Fix CMP0054 warnings
3b5ea54a CheckPrototypeDefinition: Avoid if() auto-dereference
c9b301cd ExternalProject: Fix CMP0054 warning in _ep_parse_arguments
2014-09-22 09:12:53 -04:00
Brad King 5eaa3e9025 Merge topic 'ExternalProject-retry'
30a94eec ExternalProject: Fix download retry logic
2014-09-22 09:12:50 -04:00
Matt McCormick c9b301cd71 ExternalProject: Fix CMP0054 warning in _ep_parse_arguments
Fix the CMP0054 warning:

 CMake Warning (dev) at .../Modules/ExternalProject.cmake:242 (if):
   Policy CMP0054 is not set: Only interpret if() arguments as variables or
   keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
   details.  Use the cmake_policy command to set the policy and suppress this
   warning.

   Quoted keywords like "COMMAND" will no longer be interpreted as keywords
   when the policy is set to NEW.  Since the policy is not set the OLD
   behavior will be used.
 Call Stack (most recent call first):
   .../Modules/ExternalProject.cmake:1938 (_ep_parse_arguments)
   CMakeLists.txt:5 (ExternalProject_Add)

by avoiding a reference to "${key}" or "COMMAND" in quotes.
2014-09-15 15:56:37 -04:00
Brad King b234836637 Merge topic 'vs-generator-platform'
be6a555d Tests: Test setting a generator platform in a toolchain file
d506fee8 Tests: Use -A option to pass generator platform selection
11c9ddd6 ExternalProject: Use -A option to pass generator platform
29bd843e CTest: Use -A option to pass generator platform selection
eb7d8156 cmake: Add -A option to specify a generator platform
2014-09-15 10:27:38 -04:00
Brad King 11c9ddd694 ExternalProject: Use -A option to pass generator platform
This is less verbose than defining CMAKE_GENERATOR_PLATFORM.
2014-09-15 10:26:59 -04:00