<div dir="ltr">Hello everyone,<div><br></div><div>I am trying to compile an example from VTK (FourPanesViewer) using the CMake file shown at the end of the email. The code compiles fine but when I try to run the executable (both from inside or outside visual studio) I get an error that vtkCommonCore-6.1.dll is missing. If I copy this dll in the executable's folder, I get the same error for another .dll file. To solve the problem I have included on my windows PATH the directory <VTK6-build>\bin. Note that the same problem appears when compiling with MSVC2013.</div><div><br></div><div>When compiling the same example with Qt4.8 and VTK5 on MSVC2010  using the same cmake file below, adding the \bin directory was not necessary.</div><div><br></div><div>Is there a way of avoiding adding the \bin directory to the PATH? Is there anything wrong with my Cmake file? Why changing the PATH is not necessary in VTK5?</div><div><br></div><div>Thanks a lot for you help.</div><div><br></div><div><br></div><div>=======================================</div><div>CMakeLists.txt</div><div>=======================================<br><div>#</div><div># adapted from CMakeLists.txt at <a href="http://www.cmake.org/Wiki/VTK/Examples/Cxx/Qt/SideBySideRenderWindowsQt">http://www.cmake.org/Wiki/VTK/Examples/Cxx/Qt/SideBySideRenderWindowsQt</a></div><div>#</div><div><br></div><div><div>cmake_minimum_required(VERSION 2.8)</div><div> </div><div>if(POLICY CMP0020)</div><div>  cmake_policy(SET CMP0020 NEW)</div><div>endif()</div><div> </div><div>#set a default project name</div><div>set(PROJ_NAME "PROJ_US_3D_VIS" CACHE STRING "Project name.")</div><div><br></div><div>project(${PROJ_NAME})  ## Get this from ${PROJECT_NAME}</div><div><br></div><div>set(VTK_DIR "C:/VTK-BUILDS/msvc2010/release/lib/cmake/vtk-6.1" CACHE PATH "VTK directory override" FORCE)<br></div><div>find_package(VTK REQUIRED)</div><div>include(${VTK_USE_FILE})</div><div> </div><div>if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")</div><div>  # Instruct CMake to run moc automatically when needed.</div><div>  set(CMAKE_AUTOMOC ON)</div><div>  find_package(Qt5Widgets REQUIRED QUIET)</div><div>else()</div><div>  find_package(Qt4 REQUIRED)</div><div>  include(${QT_USE_FILE})</div><div>endif()</div><div><br></div><div>set(PROJ_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/include")</div><div>include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PROJ_INCLUDE_DIRS})</div><div><br></div><div>#Create lists of all the project files</div><div>file(GLOB PROJ_HEADERS "${PROJECT_SOURCE_DIR}/src/include/*.h")</div><div>file(GLOB PROJ_SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")</div><div>file(GLOB PROJ_UIFORMS "${PROJECT_SOURCE_DIR}/src/ui/*.ui")</div><div>file(GLOB PROJ_RESOURCES "${PROJECT_SOURCE_DIR}/src/resources/*.qrc")</div><div><br></div><div>if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")</div><div>  qt5_wrap_ui(PROJ_UISOURCES ${PROJ_UIFORMS})</div><div>  qt5_add_resources(PROJ_RESOURCES_RSC ${PROJ_RESOURCES})</div><div>  # CMAKE_AUTOMOC in ON so the MocHdrs will be automatically wrapped.</div><div>  add_executable(${PROJ_NAME} </div><div>    ${PROJ_SOURCES} ${PROJ_UISOURCES} ${PROJ_HEADERS} ${PROJ_RESOURCES} ${PROJ_RESOURCES_RSC})</div><div>  qt5_use_modules(${PROJ_NAME} Core Gui Widgets)</div><div>  target_link_libraries(${PROJ_NAME} ${VTK_LIBRARIES})</div><div>else()</div><div>  QT4_WRAP_UI(PROJ_UISOURCES ${PROJ_UIFORMS})</div><div>  QT4_WRAP_CPP(PROJ_SOURCES_MOC ${PROJ_HEADERS})</div><div>  add_executable(${PROJ_NAME}  ${PROJ_SOURCES} ${PROJ_UISOURCES} ${PROJ_SOURCES_MOC})</div><div> </div><div>  if(VTK_LIBRARIES)</div><div>    if(${VTK_VERSION} VERSION_LESS "6")</div><div>      target_link_libraries(${PROJ_NAME} ${VTK_LIBRARIES} QVTK ${QT_LIBRARIES})</div><div>    else()</div><div>      target_link_libraries(${PROJ_NAME} ${VTK_LIBRARIES} ${QT_LIBRARIES})</div><div>    endif()</div><div>  else()</div><div>    target_link_libraries(${PROJ_NAME} QVTK ${QT_LIBRARIES} ${VTK_LIBRARIES})</div><div>  endif()</div><div>endif()</div></div></div><div><br></div><div>======================================================</div></div>