PointCloudLibrary / PointCloudLibrary/pcl
CMake failed if I have installed the different version VTK
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
Describe the error
CMake failed if I have installed the different version VTK.
To Reproduce
I have installed VTK-9.0 already, then I installed pcl-1.11.1(VTK-8.2). It was failed in CMake when I want to link pcl into my project. I looked into this and find pcl can't overwrite VTK_DIR which has already set.
Screenshots/Code snippets/Build information
PCLConfig.cmake:
macro(find_VTK)
message(STATUS ${PCL_ALL_IN_ONE_INSTALLER})
message(STATUS "Before Set${VTK_DIR}")
if(PCL_ALL_IN_ONE_INSTALLER AND NOT ANDROID)
if(EXISTS "${PCL_ROOT}/3rdParty/VTK/lib/cmake")
set(VTK_DIR "${PCL_ROOT}/3rdParty/VTK/lib/cmake/vtk-8.2" CACHE PATH "The directory containing VTKConfig.cmake")
message(STATUS "${PCL_ROOT}/3rdParty/VTK/lib/cmake/vtk-8.2")
message(STATUS "After Set${VTK_DIR}")
else()
set(VTK_DIR "${PCL_ROOT}/3rdParty/VTK/lib/vtk-8.2" CACHE PATH "The directory containing VTKConfig.cmake")
endif()
elseif(NOT VTK_DIR AND NOT ANDROID)
set(VTK_DIR "C:/Program Files/VTK/lib/cmake/vtk-8.2" CACHE PATH "The directory containing VTKConfig.cmake")
endif()
Print by CMake which the path didn't set success
ON
Before SetC:/Program Files/VTK/lib/cmake/vtk-9.0
D:/Program Files/PCL 1.11.1/3rdParty/VTK/lib/cmake/vtk-8.2
After SetC:/Program Files/VTK/lib/cmake/vtk-9.0
If I add FORCE behind
set(VTK_DIR "${PCL_ROOT}/3rdParty/VTK/lib/cmake/vtk-8.2" CACHE PATH "The directory containing VTKConfig.cmake" FORCE)
Path set success.
ON
Before SetC:/Program Files/VTK/lib/cmake/vtk-9.0
D:/Program Files/PCL 1.11.1/3rdParty/VTK/lib/cmake/vtk-8.2
After SetD:/Program Files/PCL 1.11.1/3rdParty/VTK/lib/cmake/vtk-8.2
Your Environment (please complete the following information):
- OS: Win10
- Compiler: Visual Studio 2019 X64
- PCL Version 1.11.1
- PCL Type:Installed
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in PCLConfig.cmake at the find_VTK macro and reproduce configuration with VTK-9.0 installed alongside PCL 1.11.1's VTK-8.2. Check how the existing VTK_DIR cache value affects selection; done means a consuming project configures and links against the intended PCL VTK version without an incorrect pre-existing path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100