summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-10-01 21:21:28 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2009-10-01 21:21:28 (GMT)
commitf9687e328f7ea64ea6384aae11af36fdd3a12643 (patch)
tree91e2555b44011705d3188f11d7b7598f29c0ba7b /Modules/ExternalProject.cmake
parent3c7354c1cd9fb081df8b3f4faef5160ea83f584f (diff)
downloadCMake-f9687e328f7ea64ea6384aae11af36fdd3a12643.zip
CMake-f9687e328f7ea64ea6384aae11af36fdd3a12643.tar.gz
CMake-f9687e328f7ea64ea6384aae11af36fdd3a12643.tar.bz2
Merge in changes to CMake-2-8 RC 2
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake70
1 files changed, 54 insertions, 16 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index aacf0b8..84c7322 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -96,6 +96,18 @@
# Property names correspond to the keyword argument names of
# 'ExternalProject_Add'.
+#=============================================================================
+# Copyright 2008-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
# Pre-compute a regex to match documented keywords for each command.
file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 100
@@ -473,13 +485,32 @@ function(_ep_get_build_command name step cmd_var)
endfunction(_ep_get_build_command)
+# This module used to use "/${CMAKE_CFG_INTDIR}" directly and produced
+# makefiles with "/./" in paths for custom command dependencies. Which
+# resulted in problems with parallel make -j invocations.
+#
+# This function was added so that the suffix (search below for ${cfgdir}) is
+# only set to "/${CMAKE_CFG_INTDIR}" when ${CMAKE_CFG_INTDIR} is not going to
+# be "." (multi-configuration build systems like Visual Studio and Xcode...)
+#
+function(_ep_get_configuration_subdir_suffix suffix_var)
+ set(suffix "")
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(suffix "/${CMAKE_CFG_INTDIR}")
+ endif()
+ set(${suffix_var} "${suffix}" PARENT_SCOPE)
+endfunction(_ep_get_configuration_subdir_suffix)
+
+
function(ExternalProject_Add_Step name step)
set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
ExternalProject_Get_Property(${name} stamp_dir)
+ _ep_get_configuration_subdir_suffix(cfgdir)
+
add_custom_command(APPEND
- OUTPUT ${cmf_dir}/${CMAKE_CFG_INTDIR}/${name}-complete
- DEPENDS ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-${step}
+ OUTPUT ${cmf_dir}${cfgdir}/${name}-complete
+ DEPENDS ${stamp_dir}${cfgdir}/${name}-${step}
)
_ep_parse_arguments(ExternalProject_Add_Step
${name} _EP_${step}_ "${ARGN}")
@@ -488,8 +519,8 @@ function(ExternalProject_Add_Step name step)
get_property(dependers TARGET ${name} PROPERTY _EP_${step}_DEPENDERS)
foreach(depender IN LISTS dependers)
add_custom_command(APPEND
- OUTPUT ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-${depender}
- DEPENDS ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-${step}
+ OUTPUT ${stamp_dir}${cfgdir}/${name}-${depender}
+ DEPENDS ${stamp_dir}${cfgdir}/${name}-${step}
)
endforeach()
@@ -499,7 +530,7 @@ function(ExternalProject_Add_Step name step)
# Dependencies on steps.
get_property(dependees TARGET ${name} PROPERTY _EP_${step}_DEPENDEES)
foreach(dependee IN LISTS dependees)
- list(APPEND depends ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-${dependee})
+ list(APPEND depends ${stamp_dir}${cfgdir}/${name}-${dependee})
endforeach()
# The command to run.
@@ -536,14 +567,14 @@ function(ExternalProject_Add_Step name step)
# Run every time?
get_property(always TARGET ${name} PROPERTY _EP_${step}_ALWAYS)
if(always)
- set_property(SOURCE ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-${step} PROPERTY SYMBOLIC 1)
+ set_property(SOURCE ${stamp_dir}${cfgdir}/${name}-${step} PROPERTY SYMBOLIC 1)
set(touch)
else()
- set(touch ${CMAKE_COMMAND} -E touch ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-${step})
+ set(touch ${CMAKE_COMMAND} -E touch ${stamp_dir}${cfgdir}/${name}-${step})
endif()
add_custom_command(
- OUTPUT ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-${step}
+ OUTPUT ${stamp_dir}${cfgdir}/${name}-${step}
COMMENT ${comment}
COMMAND ${command}
COMMAND ${touch}
@@ -557,13 +588,16 @@ endfunction(ExternalProject_Add_Step)
function(_ep_add_mkdir_command name)
ExternalProject_Get_Property(${name}
source_dir binary_dir install_dir stamp_dir download_dir tmp_dir)
+
+ _ep_get_configuration_subdir_suffix(cfgdir)
+
ExternalProject_Add_Step(${name} mkdir
COMMENT "Creating directories for '${name}'"
COMMAND ${CMAKE_COMMAND} -E make_directory ${source_dir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${binary_dir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${install_dir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${tmp_dir}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${stamp_dir}/${CMAKE_CFG_INTDIR}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${stamp_dir}${cfgdir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${download_dir}
)
endfunction(_ep_add_mkdir_command)
@@ -754,12 +788,14 @@ endfunction(_ep_add_patch_command)
function(_ep_add_configure_command name)
ExternalProject_Get_Property(${name} source_dir binary_dir)
+ _ep_get_configuration_subdir_suffix(cfgdir)
+
# Depend on other external projects (file-level).
set(file_deps)
get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
foreach(dep IN LISTS deps)
get_property(dep_stamp_dir TARGET ${dep} PROPERTY _EP_STAMP_DIR)
- list(APPEND file_deps ${dep_stamp_dir}/${CMAKE_CFG_INTDIR}/${dep}-done)
+ list(APPEND file_deps ${dep_stamp_dir}${cfgdir}/${dep}-done)
endforeach()
get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
@@ -862,9 +898,11 @@ endfunction(_ep_add_test_command)
function(ExternalProject_Add name)
+ _ep_get_configuration_subdir_suffix(cfgdir)
+
# Add a custom target for the external project.
set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
- add_custom_target(${name} ALL DEPENDS ${cmf_dir}/${CMAKE_CFG_INTDIR}/${name}-complete)
+ add_custom_target(${name} ALL DEPENDS ${cmf_dir}${cfgdir}/${name}-complete)
set_property(TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT 1)
_ep_parse_arguments(ExternalProject_Add ${name} _EP_ "${ARGN}")
_ep_set_directories(${name})
@@ -877,12 +915,12 @@ function(ExternalProject_Add name)
# custom command so that CMake does not propagate build rules to
# other external project targets.
add_custom_command(
- OUTPUT ${cmf_dir}/${CMAKE_CFG_INTDIR}/${name}-complete
+ OUTPUT ${cmf_dir}${cfgdir}/${name}-complete
COMMENT "Completed '${name}'"
- COMMAND ${CMAKE_COMMAND} -E make_directory ${cmf_dir}/${CMAKE_CFG_INTDIR}
- COMMAND ${CMAKE_COMMAND} -E touch ${cmf_dir}/${CMAKE_CFG_INTDIR}/${name}-complete
- COMMAND ${CMAKE_COMMAND} -E touch ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-done
- DEPENDS ${stamp_dir}/${CMAKE_CFG_INTDIR}/${name}-install
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${cmf_dir}${cfgdir}
+ COMMAND ${CMAKE_COMMAND} -E touch ${cmf_dir}${cfgdir}/${name}-complete
+ COMMAND ${CMAKE_COMMAND} -E touch ${stamp_dir}${cfgdir}/${name}-done
+ DEPENDS ${stamp_dir}${cfgdir}/${name}-install
VERBATIM
)