diff options
author | Wouter Klouwen <wouter.klouwen@youview.com> | 2018-10-12 18:04:49 +0100 |
---|---|---|
committer | Wouter Klouwen <wouter.klouwen@youview.com> | 2018-10-19 15:32:51 +0100 |
commit | b6f6cac378f4107d64b32981ba311b311157ce04 (patch) | |
tree | 5f12e949ff994c57a7fd1241fa13113466495ea2 /Modules/ExternalProject.cmake | |
parent | 804e11a087fdb44b8c1202521c3ba3bed0bed821 (diff) | |
download | cmake-b6f6cac378f4107d64b32981ba311b311157ce04.tar.gz |
ExternalProject: add LOG_DIR option that allows overriding of log location
In some situations it can be helpful to separate out the location of the
log files from the location of the stamp files. For instance if you have
a continuous integration that exposes the location where log files are
stored.
This commit adds an option that allows a user to override the default
behaviour of putting the log files in STAMP_DIR called LOG_DIR. The
previous behaviour of putting the log files into the STAMP_DIR applies
if LOG_DIR is not specified.
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index eb4f9fa1be..41ee7a427b 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -49,7 +49,11 @@ External Project Definition ``STAMP_DIR <dir>`` Directory in which to store the timestamps of each step. Log files from - individual steps are also created in here (see *Logging Options* below). + individual steps are also created in here unless overriden by LOG_DIR + (see *Logging Options* below). + + ``LOG_DIR <dir>`` + Directory in which to store the logs of each step. ``DOWNLOAD_DIR <dir>`` Directory in which to store downloaded files before unpacking them. This @@ -92,6 +96,7 @@ External Project Definition SOURCE_DIR = <prefix>/src/<name> BINARY_DIR = <prefix>/src/<name>-build INSTALL_DIR = <prefix> + LOG_DIR = <STAMP_DIR> Otherwise, if the ``EP_BASE`` directory property is set then components of an external project are stored under the specified base:: @@ -102,6 +107,7 @@ External Project Definition SOURCE_DIR = <base>/Source/<name> BINARY_DIR = <base>/Build/<name> INSTALL_DIR = <base>/Install/<name> + LOG_DIR = <STAMP_DIR> If no ``PREFIX``, ``EP_PREFIX``, or ``EP_BASE`` is specified, then the default is to set ``PREFIX`` to ``<name>-prefix``. Relative paths are @@ -517,7 +523,8 @@ External Project Definition **Output Logging Options:** Each of the following ``LOG_...`` options can be used to wrap the relevant step in a script to capture its output to files. The log files will be - created in the ``STAMP_DIR`` directory with step-specific file names. + created in ``LOG_DIR`` if supplied or otherwise the ``STAMP_DIR`` + directory with step-specific file names. ``LOG_DOWNLOAD <bool>`` When enabled, the output of the download step is logged to files. @@ -713,7 +720,7 @@ control needed to implement such step-level capabilities. ``LOG <bool>`` If set, this causes the output from the custom step to be captured to files - in the external project's ``STAMP_DIR``. + in the external project's ``LOG_DIR`` if supplied or ``STAMP_DIR``. ``USES_TERMINAL <bool>`` If enabled, this gives the custom step direct access to the terminal if @@ -1620,6 +1627,7 @@ function(_ep_set_directories name) set(stamp_default "${base}/Stamp/${name}") set(install_default "${base}/Install/${name}") endif() + set(log_default "${stamp_default}") get_property(build_in_source TARGET ${name} PROPERTY _EP_BUILD_IN_SOURCE) if(build_in_source) get_property(have_binary_dir TARGET ${name} PROPERTY _EP_BINARY_DIR SET) @@ -1629,7 +1637,7 @@ function(_ep_set_directories name) endif() endif() set(top "${CMAKE_CURRENT_BINARY_DIR}") - set(places stamp download source binary install tmp) + set(places stamp download source binary install tmp log) foreach(var ${places}) string(TOUPPER "${var}" VAR) get_property(${var}_dir TARGET ${name} PROPERTY _EP_${VAR}_DIR) @@ -1683,7 +1691,7 @@ macro(_ep_replace_location_tags target_name) set(vars ${ARGN}) foreach(var ${vars}) if(${var}) - foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOAD_DIR DOWNLOADED_FILE) + foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOAD_DIR DOWNLOADED_FILE LOG_DIR) get_property(val TARGET ${target_name} PROPERTY _EP_${dir}) string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}") endforeach() @@ -1865,6 +1873,7 @@ function(_ep_get_build_command name step cmd_var) endfunction() function(_ep_write_log_script name step cmd_var) + ExternalProject_Get_Property(${name} log_dir) ExternalProject_Get_Property(${name} stamp_dir) set(command "${${cmd_var}}") @@ -1936,7 +1945,7 @@ endif() # Wrap the command in a script to log output to files. set(script ${stamp_dir}/${name}-${step}-$<CONFIG>.cmake) - set(logbase ${stamp_dir}/${name}-${step}) + set(logbase ${log_dir}/${name}-${step}) set(code " ${code_cygpath_make} set(command \"${command}\") @@ -2224,7 +2233,7 @@ endfunction() function(_ep_add_mkdir_command name) ExternalProject_Get_Property(${name} - source_dir binary_dir install_dir stamp_dir download_dir tmp_dir) + source_dir binary_dir install_dir stamp_dir download_dir tmp_dir log_dir) _ep_get_configuration_subdir_suffix(cfgdir) @@ -2236,6 +2245,7 @@ function(_ep_add_mkdir_command name) COMMAND ${CMAKE_COMMAND} -E make_directory ${tmp_dir} COMMAND ${CMAKE_COMMAND} -E make_directory ${stamp_dir}${cfgdir} COMMAND ${CMAKE_COMMAND} -E make_directory ${download_dir} + COMMAND ${CMAKE_COMMAND} -E make_directory ${log_dir} ) endfunction() |