vtk CPM cache in wrong directory causes subsequent builds to fail
Description
With the following folder structure:
./
.cache/
CPM/
opengeosys/
ogs-source/
build/
release-petsc
Upon configuration another .cache/CPM/vtk is created inside the opengeosys folder, as well as vtk-config.cmake and vtk-config-version.cmake inside the release-petsc folder. On a subsequent configuration after the initial build, the configuration fails.
Expected behavior: no error on subsequent builds
Actual behavior:
CMake Error at /home/fzill/opengeosys/build/release-petsc/_deps/vtk-build/lib/cmake/vtk-9.1/vtk-config.cmake:138 (include):
include could not find requested file:
/home/fzill/opengeosys/build/release-petsc/_deps/vtk-build/lib/cmake/vtk-9.1/VTK-targets.cmake
Call Stack (most recent call first):
/home/fzill/opengeosys/build/release-petsc/vtk-config.cmake:1 (include)
scripts/cmake/Dependencies.cmake:273 (find_package)
CMakeLists.txt:92 (include)
CMake Error at /home/fzill/opengeosys/build/release-petsc/_deps/vtk-build/lib/cmake/vtk-9.1/vtk-config.cmake:139 (include):
include could not find requested file:
/home/fzill/opengeosys/build/release-petsc/_deps/vtk-build/lib/cmake/vtk-9.1/VTK-vtk-module-properties.cmake
Call Stack (most recent call first):
/home/fzill/opengeosys/build/release-petsc/vtk-config.cmake:1 (include)
scripts/cmake/Dependencies.cmake:273 (find_package)
CMakeLists.txt:92 (include)
CMake Error at /home/fzill/opengeosys/build/release-petsc/_deps/vtk-build/lib/cmake/vtk-9.1/vtk-config.cmake:150 (include):
include could not find requested file:
/home/fzill/opengeosys/build/release-petsc/_deps/vtk-build/lib/cmake/vtk-9.1/VTK-vtk-module-find-packages.cmake
Call Stack (most recent call first):
/home/fzill/opengeosys/build/release-petsc/vtk-config.cmake:1 (include)
scripts/cmake/Dependencies.cmake:273 (find_package)
CMakeLists.txt:92 (include)
CMake Warning at scripts/cmake/Dependencies.cmake:273 (find_package):
Found package configuration file:
/home/fzill/opengeosys/build/release-petsc/vtk-config.cmake
but it set VTK_FOUND to FALSE so package "VTK" is considered to be NOT
FOUND. Reason given by package:
Could not find the VTK package with the following required components:
FiltersGeneral, FiltersParallel, FiltersSources, IOLegacy, IOParallelXML,
IOXML, ParallelMPI.
Call Stack (most recent call first):
CMakeLists.txt:92 (include)
CMake Warning at /home/fzill/.cache/CPM/vtk/c9ccb7b14c4e32ed09ad5b5b2eb1ae604daf6a27/ThirdParty/lzma/vtklzma/CMakeLists.txt:112 (find_package):
for module Threads already called with REQUIRED, thus
CMAKE_REQUIRE_FIND_PACKAGE_Threads has no effect.
If it helps pinpointing the problem, after a subsequent failing configuration in the CMakeCache.txt the unwanted cache is found for multiple libraries (Eigen3, expat, pugixml, tiff, verdict, metaio, vtksys, zlib):
//Value Computed by CMake
Eigen3_BINARY_DIR:STATIC=/home/fzill/opengeosys/.cache/CPM/vtk/c9ccb7b14c4e32ed09ad5b5b2eb1ae604daf6a27/ThirdParty/eigen/vtkeigen
Specifications
- Version: ogs version: 6.4.3-614-g5f228887.dirty
- Platform: Ubuntu-22.04 in WSL under Windows