One of my projects (derived from Paraview and including some additional modules and plugins) seems to work now also with the “superbuild” for generating a Windows installation package.
From what I understand so far, there are different steps happening:
-
first a “build” run for the main project and all the depending projects, from boost to Paraview to whatever. The result of this run ends up basically in the sb_target/superbuild directory and it’s subdirectories.
-
then an “install” run - not really an installation, but the “copy with extras” that is called “installation” in the cmake language. This step is basically supposed to move those files that will finally go to the package into the sb_target/superbuild directory tree.
These two steps are done during the “cmake” and the “ninja” runs.
The final step, started with ctest -R …, brings finally the files for the package into still another directory tree, rooted at sb_target/_CPack_Packages.
This works nicely for that first project now, but for a very similar project that is based on the first one the second step fails: the “install” brings the files coming from that project not to sb_target/install, but to sb_target/superbuild/second_project/build/install. So the third step does not find them in the right place!
And the question is WHY?
First of all, in the CMakeLists.txt of the projects themselves (not the superbuild projects), I have in both cases this line:
set(CMAKE_INSTALL_PREFIX “${CMAKE_BINARY_DIR}/install”)
(ok, in the first project, that line still has the following - no real idea what the difference is:
set(CMAKE_INSTALL_PREFIX “${CMAKE_BINARY_DIR}/install” CACHE PATH “”
could THIS be the crucial difference??)
In both superbuild target directories I find the following entry in the CMakeCache.txt:
CMAKE_INSTALL_PREFIX:PATH="<sb_target>/install"
with <sb_target> explicitly being the correct path where the sb “install” step should put it’s stuff.
And in the same superbuild target directories I also find a cmake_install.cmake file - and there things are different:
first project - where everything works fine:
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX “<sb_target>/install”
while in the second project - where the “install” goes to the wrong location it is:
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX )
So obviously it comes from this cmake_install.cmake script - but how does it get in there? Because from all that I am reading here and there, my only conclusion is that “somehow” the setting from the project would be written there - but that is the same in both projects!
Also I have no explicit “install” commands in any of my own CMakeLists.txt, so only what happens inside the different paraview and vtk module and plugin generation functions is happening - which all do not interfere with the CMAKE_INSTALL_PREFIX as far as I have realized so far.
So I am lost again - and this after so many weeks of finally trying to understand what this miraculous “cmake installation” actually does! Well, I learned that it basically writes the cmake_install.cmake script - which is already good to know. And with this knowledge I could also see that the wrong “install” target comes somehow from that file. Which in turn means for me that the problem does not lie in the superbuild, but in the initial project already. Only that I do not see a difference there in what I am doing - so why the difference in the result?