Request for Changes-32: Allow a module to be built outside the OTB source tree

From OTBWiki
Jump to: navigation, search

Status


Summary

This RFC introduces a way to build a module outside the OTB source tree

Rationale

This allows a module to be built outside the OTB source tree by adding the following to the module's top level CMakeLists.txt:

 project(MyModule)
 if(NOT OTB_SOURCE_DIR)
   find_package(OTB REQUIRED)
   list(APPEND CMAKE_MODULE_PATH ${OTB_CMAKE_DIR})
   include(OTBModuleExternal)
 else()
   otb_module_impl()
 endif()

Move otb_add_test into CMake/OTBModuleTest.cmake so they can be re-used.

This can be used for building against an ITK build tree, not an install tree.

This contribution is mostly inspired by Matt McCormick to ITK to support ITK module outside the source tree:

https://github.com/InsightSoftwareConsortium/ITK/commit/387e9ff8712751a65ff65e36e526c92525d906aa

The OTB template module was also updated accordingly:

https://github.com/orfeotoolbox/otbExternalModuleTemplate

Implementation details

Classes and files

Changes happen in cmake configuration to handle modules outside the OTB source tree. It is still possible to build remote module in the source tree Module/Remote directory

Documentation

Documentation in the Software Guide and the wiki which describes how to write a remote module have been updated.

Additional notes