CMake error when trying to install a CEP dependent on another CEP
In CamiTK community edition, the cep-generator test allows us to check that everything works when compiling a CEP that depends on CamiTK SDK There is no test that check the third-level dependency, i.e., when trying to compile and install a CEP that depends on another CEP that depends on CamiTK SDK. With recent version of CMake, warnings about missing autogen target became errors. Now it is not possible to install a CEP that depends on another already installed CEP without a CMake error (although it is possible to build it...).
Steps to Reproduce
This is quite long to reproduce:
- build and install the latest develop version of CamiTK CE
- create a CEP called level2cep that has dependencies to CamiTK SDK, e.g. that have a component that depends on medicalimageviewer or vtkmesh. This CEP should create a new component, lets call it level2comp
- build an install level2cep
- create a CEP called level3cep that has dependencies to level2Cp, e.g. that have a component that depends on level2comp
- build level3cep At configure time you should see an error:
CMake Error in components/level2comp/CMakeLists.txt: The dependency target "component-level2comp" of target "component-level2comp_autogen" does not exist.
BUT the build will finish and everything will work 6. try to install level3cep, you you will get the same error but the install will fail.
Actual VS Expected Result
There should be no error and the the install should work.
Interpretation & Possible fixes
CMake camitk_extension macro should take into account the fact that if a target is not found, it should be declared as imported.
Possible fix: add a test in camitk_extension to check if a target exist or not using
if (NOT TARGET ...)
if (NOT TARGET ...) will not be able to distinguish between external targets and local targets that are not yet declared in the configuration process.
please do not remove anything below this line