CMake code generation over viewer's extension targets
## About you CamiTK dev ## Overview If a component or action declares a dependency to a viewer extension, CMake generates an error during generation. ```bash CMake Error in actions/testactions/CMakeLists.txt: The dependency target "viewer-medicalimageviewer" of target "action-testactions_autogen" does not exist. ``` → The viewer's extension targets are not exported properly and generate an error ## Steps to Reproduce In an action `CMakeLists.txt`, add the following line inside the `camitk_extension` parameters: ```cmake camitk_extension(ACTION_EXTENSION ... NEEDS_VIEWER_EXTENSION medicalimageviewer ... ) ``` ## Actual VS Expected Result When running the CMake generation on the project, the following error is generated ```bash CMake Error in actions/testactions/CMakeLists.txt: The dependency target "viewer-medicalimageviewer" of target "action-testactions_autogen" does not exist. ``` The target is not known by the CEP as it is not exported by CamiTK CE. The expected result is a error free CMake generation I created a specific branch and MR (see !147) with cepgenerator test files. This can be considered as fixed when the test `application-cepgenerator-bash-test` in MR !147 returns no error. To run the test : - checkout branch `bug/target-export` - configure and build - run the corresponding test: ```bash ctest -VV -R application-cepgenerator-bash-test ``` ## Interpretation & Possible fixes Two possible fixes: - ~~either fix CamiTK CMake files so that extensions are exported~~ - ~~tweak the cepgenerator to add the following lines in the generated action `CMakeLists.txt` AND document the manual fix in the wiki.~~ ```cmake # Add this line in the action or component CMakeLists.txt, before the call to the camitk_extension macro add_library(viewer-medicalimageviewer INTERFACE IMPORTED) ``` - ~~FindCamiTK.cmake includes these export lines~~ Note that a similar line has to be added from each added NEEDS_VIEWER_EXTENSION dependencies ## CamiTK Version `CamiTK version........................... CamiTK 4.2.dev.bug-target-export.0cf6a8fa` ~"Track Debugging"
issue