Skip to content

Commit 4196df9

Browse files
committed
COMP: Fix ExternalData when ITK is built with FetchContent
Addresses two issue: - When ITK is built from FetchContent, the fetched source is outside of the main source. This is an error with external data paths, so use the ITK PROJECT source path as the default for ITK's External data. - Use PROJECT_BINARY_DIR for output of download data, to prevent target conflics with the main project.
1 parent 5032829 commit 4196df9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CMake/ExternalData.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ function(_ExternalData_arg target arg options var_file)
609609

610610
# Convert to relative path under the source tree.
611611
if(NOT ExternalData_SOURCE_ROOT)
612-
set(ExternalData_SOURCE_ROOT "${CMAKE_SOURCE_DIR}")
612+
set(ExternalData_SOURCE_ROOT "${PROJECT_SOURCE_DIR}")
613613
endif()
614614
set(top_src "${ExternalData_SOURCE_ROOT}")
615615
file(RELATIVE_PATH reldata "${top_src}" "${absdata}")

CMake/ITKExternalData.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ list(
2828
APPEND
2929
ExternalData_OBJECT_STORES
3030
# Local data store populated by the ITK pre-commit hook
31-
"${CMAKE_SOURCE_DIR}/.ExternalData"
31+
"${PROJECT_SOURCE_DIR}/.ExternalData"
3232
)
3333

34-
set(ExternalData_BINARY_ROOT ${CMAKE_BINARY_DIR}/ExternalData)
34+
set(ExternalData_BINARY_ROOT ${PROJECT_BINARY_DIR}/ExternalData)
3535

3636
# Expands %(algo:lower)
3737
set(ExternalData_URL_ALGO_CID_lower cid)

0 commit comments

Comments
 (0)