Skip to content

Commit 17b39e8

Browse files
committed
Fix ITK_LIB_DIR (dll folder) when using installed version on windows
1 parent 5825077 commit 17b39e8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmake/Common.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ include(${ITK_USE_FILE}) # <- maybe avoid by using include/link commands on targ
185185
set(ITK_BASE_DIR "${ITK_DIR}")
186186
if (MSVC)
187187
set(ITK_LIB_DIR "${ITK_DIR}/bin/Release")
188+
# TODO: avoid duplication between here and folder for Visual studio running environment path
189+
if (EXISTS "${ITK_DIR}/bin/Release")
190+
set(ITK_LIB_DIR "${ITK_DIR}/bin/Release")
191+
else()
192+
# when using an installed ITK version, we only know the relative path from the itk-config.cmake file
193+
# we are not aware of a variable containing the "base folder" of the ITK installation
194+
get_filename_component(ITK_LIB_DIR "../../../bin" REALPATH BASE_DIR "${ITK_DIR}")
195+
if (NOT EXISTS "${ITK_LIB_DIR}")
196+
message(WARNING "Did not find the folder containing the ITK dll's (checked: ${ITK_DIR}/bin/Release, ${ITK_LIB_DIR}). Installation will fail!")
197+
endif()
198+
endif()
188199
else()
189200
if (EXISTS "${ITK_DIR}/lib")
190201
set(ITK_LIB_DIR "${ITK_DIR}/lib")
@@ -332,7 +343,7 @@ if (MSVC)
332343
# we are not aware of a variable containing the "base folder" of the VTK installation
333344
get_filename_component(VTK_LIB_DIR "../../../bin" REALPATH BASE_DIR "${VTK_DIR}")
334345
if (NOT EXISTS "${VTK_LIB_DIR}")
335-
message(SEND_ERROR "Did not find a VTK dll folder (checked: ${VTK_DIR}/bin/Release, ${VTK_LIB_DIR})!")
346+
message(WARNING "Did not find the folder containing the VTK dll's (checked: ${VTK_DIR}/bin/Release, ${VTK_LIB_DIR}). Installation will fail!")
336347
endif()
337348
endif()
338349
else()

0 commit comments

Comments
 (0)