Skip to content

Commit a57fb48

Browse files
committed
CMake: make install work using installed VTK version (fix)
1 parent 5660950 commit a57fb48

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmake/Common.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,16 @@ if ("IOOggTheora" IN_LIST VTK_AVAILABLE_COMPONENTS)
324324
endif()
325325
find_package(VTK COMPONENTS ${VTK_COMPONENTS})
326326
if (MSVC)
327+
# TODO: avoid duplication between here and folder for Visual studio running environment path
327328
if (EXISTS "${VTK_DIR}/bin/Release")
328329
set(VTK_LIB_DIR "${VTK_DIR}/bin/Release")
329-
elseif (EXISTS "${VTK_DIR}/bin")
330-
set(VTK_LIB_DIR "${VTK_DIR}/bin")
331330
else()
332-
message(SEND_ERROR "Did not find a VTK dll folder in ${VTK_DIR}!")
331+
# when using an installed VTK version, we only know the relative path from the vtk-config.cmake file
332+
# we are not aware of a variable containing the "base folder" of the VTK installation
333+
get_filename_component(VTK_LIB_DIR "../../../bin" REALPATH BASE_DIR "${VTK_DIR}")
334+
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})!")
336+
endif()
333337
endif()
334338
else()
335339
if (EXISTS "${VTK_DIR}/lib")

0 commit comments

Comments
 (0)