summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake62
1 files changed, 35 insertions, 27 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 9694563..1e0be09 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1097,10 +1097,14 @@ function(_ep_set_directories name)
endforeach()
get_property(source_subdir TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR)
if(NOT source_subdir)
- set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR ".")
+ set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR "")
elseif(IS_ABSOLUTE "${source_subdir}")
message(FATAL_ERROR
"External project ${name} has non-relative SOURCE_SUBDIR!")
+ else()
+ # Prefix with a slash so that when appended to the source directory, it
+ # behaves as expected.
+ set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR "/${source_subdir}")
endif()
if(build_in_source)
get_property(source_dir TARGET ${name} PROPERTY _EP_SOURCE_DIR)
@@ -1186,6 +1190,7 @@ function(_ep_write_initial_cache target_name script_filename script_initial_cach
# Write out values into an initial cache, that will be passed to CMake with -C
# Replace location tags.
_ep_replace_location_tags(${target_name} script_initial_cache)
+ _ep_replace_location_tags(${target_name} script_filename)
# Write out the initial cache file to the location specified.
file(GENERATE OUTPUT "${script_filename}" CONTENT "${script_initial_cache}")
endfunction()
@@ -1194,10 +1199,11 @@ endfunction()
function(ExternalProject_Get_Property name)
foreach(var ${ARGN})
string(TOUPPER "${var}" VAR)
- get_property(${var} TARGET ${name} PROPERTY _EP_${VAR})
- if(NOT ${var})
+ get_property(is_set TARGET ${name} PROPERTY _EP_${VAR} SET)
+ if(NOT is_set)
message(FATAL_ERROR "External project \"${name}\" has no ${var}")
endif()
+ get_property(${var} TARGET ${name} PROPERTY _EP_${VAR})
set(${var} "${${var}}" PARENT_SCOPE)
endforeach()
endfunction()
@@ -2187,24 +2193,7 @@ function(_ep_add_patch_command name)
endfunction()
-# TODO: Make sure external projects use the proper compiler
-function(_ep_add_configure_command name)
- ExternalProject_Get_Property(${name} source_dir source_subdir binary_dir tmp_dir)
-
- # 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_type TARGET ${dep} PROPERTY TYPE)
- if(dep_type STREQUAL "UTILITY")
- get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
- if(is_ep)
- _ep_get_step_stampfile(${dep} "done" done_stamp_file)
- list(APPEND file_deps ${done_stamp_file})
- endif()
- endif()
- endforeach()
-
+function(_ep_extract_configure_command var name)
get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
if(cmd_set)
get_property(cmd TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND)
@@ -2225,7 +2214,7 @@ function(_ep_add_configure_command name)
get_property(cmake_cache_default_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_DEFAULT_ARGS)
if(cmake_cache_args OR cmake_cache_default_args)
- set(_ep_cache_args_script "${tmp_dir}/${name}-cache-$<CONFIG>.cmake")
+ set(_ep_cache_args_script "<TMP_DIR>/${name}-cache-$<CONFIG>.cmake")
if(cmake_cache_args)
_ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
endif()
@@ -2267,13 +2256,32 @@ function(_ep_add_configure_command name)
endif()
endif()
- if(source_subdir STREQUAL ".")
- list(APPEND cmd "${source_dir}")
- else()
- list(APPEND cmd "${source_dir}/${source_subdir}")
- endif()
+ list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
endif()
+ set("${var}" "${cmd}" PARENT_SCOPE)
+endfunction()
+
+# TODO: Make sure external projects use the proper compiler
+function(_ep_add_configure_command name)
+ ExternalProject_Get_Property(${name} binary_dir tmp_dir)
+
+ # 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_type TARGET ${dep} PROPERTY TYPE)
+ if(dep_type STREQUAL "UTILITY")
+ get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
+ if(is_ep)
+ _ep_get_step_stampfile(${dep} "done" done_stamp_file)
+ list(APPEND file_deps ${done_stamp_file})
+ endif()
+ endif()
+ endforeach()
+
+ _ep_extract_configure_command(cmd ${name})
+
# If anything about the configure command changes, (command itself, cmake
# used, cmake args or cmake generator) then re-run the configure step.
# Fixes issue https://gitlab.kitware.com/cmake/cmake/issues/10258