Script to setup a namespace for OTB imported targets
This script allows to protect the imported target in OTB install with a namespace. By default, when doing
find_package(OTB), OTB libraries, applications and executables are declared as
IMPORTED targets. But if a target name is in conflict with your project, CMake will throw an error.
Let say I want to build SertitObject remote module as standalone. The target
otbapp_Aggregate may be declared twice: in the OTB package, and in SertitObject sources.
With the script,
NamespaceHandler.cmake, you can set a namespace in front of all
IMPORTED targets of OTB install tree.
For instance, calling:
ctest -DNAMESPACE:STRING="NS" -S NamespaceHandler.cmake
NS::otbapp_Aggregate. The double colon also has a special meaning for target names: CMake will check that the target is either an
Note: this script will be used for the CI of remote module SertitObject, and maybe other remote modules that are already in OTB standalone packages.