Hi,
I want to create an installation of ITK with the debug and releaseWithDebInfo dll on the same folder, thanks to the CMAKE_DEBUG_POSTFIX. For this, I run two times the build and installation with the releaseWithDebInfo and debug build type, and the same install prefix folder.
However, I can notice in the second install, the following line:
-- Old export file "D:/.conan/8c8045/1/lib/cmake/ITK-5.0/ITKTargets.cmake" will be replaced. Removing files [D:/.conan/8c8045/1/lib/cmake/ITK-5.0/ITKTargets-relwithdebinfo.cmake].
-- Installing: D:/.conan/8c8045/1/lib/cmake/ITK-5.0/ITKTargets.cmake
-- Installing: D:/.conan/8c8045/1/lib/cmake/ITK-5.0/ITKTargets-debug.cmake
This is the first time I see an install script uninstalling cmake target files from a previous install.
Is it normal or is it a bug ?
If it is normal, how I am supposed to achieve an same installation for two configurations? Shall I merge myself the two installs and not use the same install prefix ?
I am building ITK 5.0.1, with cmake 3.16.5, on MSVC 16.5, Windows 10. Here is my cmake configuration:
BUILD_SHARED_LIBS=ON
CMAKE_DEBUG_POSTFIX="d"
BUILD_TESTING]=OFF
Module_RTK=ON
RTK_USE_CUDA=ON
RTK_BUILD_APPLICATIONS=OFF
Best regards,
Simon
If you install multiple configurations, there should be multiple ITKTargets-*.cmake files, one for each configuration. But ITKTargets.cmake exists for each configuration, and needs to be overwritten. Are file contents the same? Does your installation work with both configurations?
Please use a separate install prefix per configuration.
@dzenanz : The ITKTargets.cmake targets file are exactly the same for both Debug and RelWithDebInfo config. Yes my installation works with both configuration.
@thewtex : Do you know why we have that behavior? I am genuinely curious. We use the same config mixing mechanism for our own libraries, with VTK 8.2.0 it is also ok, and I feel that it was the intended behavior of cmake as we have those target files split into the common part and the part different for each config.
I don't think it is possible to avoid overwriting ITKTargets.cmake. And if everything works fine, that warning is not much of an issue.
@Siron777 patches are welcome to improve support for this if you want to dive into the CMake export configuration and any necessary changes to the third party library configurations that we vendor.
@dzenanz ITKTargets.cmake is indeed fine, it is recreated exactly the same (I though your question of comparison was to be sure this file was the same for both configuration and could be mix up), the issue is about ITKTargets-RelWithDebInfo.cmake which is removed by the debug install (this is specified at the end of the warning) and not recreated. At the end the install folder has the RelWithDebInfo dll/lib, but not any more the ITKTargets-RelWithDebInfo.cmake.
@thewtex If I can, I will help. What the CMake install is doing here does not seems to be the usual case. In our internal projects, or in VTK, I do not observer that behavior. I do not know what is triggering that behavior.
From experience with VCPKG: ITKTargets.cmake might not be the same if libraries are linked directly and the configuration have different prefixes. Then the INTERFACE_LINK_LIBRARIES will contain the library name and the absoulte path to the library. This is a typical problem with *Targets.cmake in VCPKG and results in a lot of link errors since it also merges artifacts from Debug and Release. If ITK switched like VTK to be all targets in the INTERFACE_LINK_LIBRARIES property of the exported targets then it should be fine.
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
Most helpful comment
@dzenanz ITKTargets.cmake is indeed fine, it is recreated exactly the same (I though your question of comparison was to be sure this file was the same for both configuration and could be mix up), the issue is about ITKTargets-RelWithDebInfo.cmake which is removed by the debug install (this is specified at the end of the warning) and not recreated. At the end the install folder has the RelWithDebInfo dll/lib, but not any more the ITKTargets-RelWithDebInfo.cmake.
@thewtex If I can, I will help. What the CMake install is doing here does not seems to be the usual case. In our internal projects, or in VTK, I do not observer that behavior. I do not know what is triggering that behavior.