I installed two versions of VTK in my ubuntu20.04
1, VTK9.1.0 in customed path /home/hitbuyi/PCL/VTK_9.1
in ~/.bashrc, I set the environment varibles like this
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hitbuyi/PCL/VTK_9.1/lib/
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/home/hitbuyi/PCL/VTK_9.1/include
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/home/hitbuyi/PCL/VTK_9.1/include
export VTK_DIR=/home/hitbuyi/PCL/VTK_9.1
export PATH="/home/hitbuyi/PCL/VTK_9.1/bin:$PATH"
and the CMake can found VTK correctly, it’s oupt of is
-- VTK_VERSION: 9.1.0, Qt Version: 5.12.8
print_vtk_lib_module,VTK::CommonCoreVTK::CommonDataModelVTK::FiltersSourcesVTK::GUISupportQtVTK::InteractionStyleVTK::RenderingContextOpenGL2VTK::RenderingCoreVTK::RenderingFreeTypeVTK::RenderingGL2PSOpenGL2VTK::RenderingOpenGL2VTK::GUISupportQtVTK::RenderingQt
in CMakeLists.txt , use
find(VTK)
CMake can found VTK9.1 correctly, I print print_vtk_lib_module
1, VTK7.1.0 installed in default manner, its lib path, include path are in different folder, like this
camke
...
/usr/lib/cmake/vtk-7.1
/usr/lib/cmake/vtk-7.1/VTKConfig.cmake
/usr/lib/cmake/vtk-7.1/VTKConfigVersion.cmake
/usr/lib/cmake/vtk-7.1/VTKGenerateExportHeader.cmake
/usr/lib/cmake/vtk-7.1/vtkTestingMacros.cmake
/usr/lib/cmake/vtk-7.1/vtkTestingRenderingDriver.cmake
/usr/lib/cmake/vtk-7.1/vtkThirdParty.cmake
/usr/lib/cmake/vtk-7.1/Modules/vtkChartsCore-Headers.cmake
/usr/lib/cmake/vtk-7.1/Modules/vtkCommonColor-Headers.cmake
...
include
...
/usr/include/vtk-7.1/vtkSLACParticleReader.h
/usr/include/vtk-7.1/vtkSLACReader.h
/usr/include/vtk-7.1/vtkSLCReader.h
/usr/include/vtk-7.1/vtkSMPContourGrid.h
/usr/include/vtk-7.1/vtkSMPThreadLocal.h
/usr/include/vtk-7.1/vtkSMPThreadLocalObject.h
...
libs
...
/usr/lib/x86_64-linux-gnu/libvtkmetaio-7.1.so.7.1p.1
/usr/lib/x86_64-linux-gnu/libvtkproj4-7.1.so
/usr/lib/x86_64-linux-gnu/libvtkproj4-7.1.so.7.1p
/usr/lib/x86_64-linux-gnu/libvtkxdmf2-7.1.so
/usr/lib/x86_64-linux-gnu/libvtkxdmf2-7.1.so.7.1p
/usr/lib/x86_64-linux-gnu/libvtkxdmf2-7.1.so.7.1p.1
....
in CMakeLists.txt file, I set like this
set(VTK_INCLUDE_DIRS "/usr/include/vtk-7.1")
#SET(VTK_DIR "/usr/lib/cmake/vtk-7.1/VTKConfig.cmake")
SET(VTK_DIR "/usr/lib/cmake/vtk-7.1/")
set(VTK_LIBRARIES, "/usr/lib/x86_64-linux-gnu")
target_link_libraries(MinimalQtVTKApp
${VTK_LIBRARIES}
#/usr/lib/x86_64-linux-gnu/
)
not use find(VTK)
During the compiling stage, CMake can’t no find VTK7.1.0 correctly, ${VTK_LIBRARIES} is null
in my case, How to set CMakeLists.txt to find VTK7.1.0 correctly?