Skip to content

Commit 76c1bf3

Browse files
authored
Merge pull request InsightSoftwareConsortium#6005 from hjmjohnson/fix-expat-system-include-path
BUG: Fix itk_expat.h not found when ITK_USE_SYSTEM_EXPAT is ON
2 parents 19eb086 + d5cb04b commit 76c1bf3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Modules/ThirdParty/Expat/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ mark_as_advanced(ITK_USE_SYSTEM_EXPAT)
1010

1111
if(ITK_USE_SYSTEM_EXPAT)
1212
find_package(EXPAT REQUIRED)
13-
set(ITKExpat_INCLUDE_DIRS ${ITKExpat_BINARY_DIR}/src)
13+
set(
14+
ITKExpat_INCLUDE_DIRS
15+
${ITKExpat_BINARY_DIR} # <- for itk_expat.h
16+
)
1417
set(ITKExpat_SYSTEM_INCLUDE_DIRS "${EXPAT_INCLUDE_DIR}")
1518
set(ITKExpat_LIBRARIES "${EXPAT_LIBRARY}")
1619
set(ITKExpat_NO_SRC 1)
@@ -44,6 +47,10 @@ else()
4447
endif()
4548

4649
configure_file(itk_expat.h.in ${ITKExpat_BINARY_DIR}/itk_expat.h)
50+
# Remove stale itk_expat.h from pre-bfc8e07d build trees that generated it
51+
# into the src/ subdirectory. A leftover copy can shadow the current file
52+
# and confuse incremental builds.
53+
file(REMOVE ${ITKExpat_BINARY_DIR}/src/itk_expat.h)
4754
if(NOT ITK_USE_SYSTEM_EXPAT AND NOT ITK_FUTURE_LEGACY_REMOVE)
4855
# Configure a file with the name <expat.h> as was the default in ITKv5 and earlier
4956
# so that "#include <expat.h>" finds the itk mangled symbols during linkage stage.

0 commit comments

Comments
 (0)