Commit 73b40168 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: application macro support external projects

parent c24f6b96
...@@ -7,13 +7,17 @@ macro(otb_create_application) ...@@ -7,13 +7,17 @@ macro(otb_create_application)
include_directories(${APPLICATION_INCLUDE_DIRS}) include_directories(${APPLICATION_INCLUDE_DIRS})
add_library(${APPLICATION_TARGET_NAME} MODULE ${APPLICATION_SOURCES}) add_library(${APPLICATION_TARGET_NAME} MODULE ${APPLICATION_SOURCES})
target_link_libraries(${APPLICATION_TARGET_NAME} OTBApplicationEngine ${APPLICATION_LINK_LIBRARIES}) target_link_libraries(${APPLICATION_TARGET_NAME} OTBApplicationEngine ${APPLICATION_LINK_LIBRARIES})
otb_module_target_label(${APPLICATION_TARGET_NAME}) if(otb-module)
otb_module_target_label(${APPLICATION_TARGET_NAME})
endif()
# Setup build output location # Setup build output location
# Do not output in the standard lib folder where all shared libs goes. # Do not output in the standard lib folder where all shared libs goes.
# This is to avoid the application factory to look into each and every shared lib # This is to avoid the application factory to look into each and every shared lib
# for itkLoad symbol # for itkLoad symbol
set_property(TARGET ${APPLICATION_TARGET_NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/otb/applications) if(otb-module)
set_property(TARGET ${APPLICATION_TARGET_NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/otb/applications)
endif()
# Remove the usual 'lib' prefix to make it clear it is a plugin # Remove the usual 'lib' prefix to make it clear it is a plugin
# and not a shared library to link against # and not a shared library to link against
...@@ -31,9 +35,20 @@ macro(otb_create_application) ...@@ -31,9 +35,20 @@ macro(otb_create_application)
endif() endif()
if (APPLICATION_INSTALL_PATH) if (APPLICATION_INSTALL_PATH)
if(otb-module)
install(TARGETS ${APPLICATION_TARGET_NAME}
EXPORT ${${otb-module}-targets}
LIBRARY DESTINATION ${APPLICATION_INSTALL_PATH}
COMPONENT RuntimeLibraries)
else()
install(TARGETS ${APPLICATION_TARGET_NAME}
LIBRARY DESTINATION ${APPLICATION_INSTALL_PATH}
COMPONENT RuntimeLibraries)
endif()
else()
install(TARGETS ${APPLICATION_TARGET_NAME} install(TARGETS ${APPLICATION_TARGET_NAME}
EXPORT ${${otb-module}-targets} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${APPLICATION_INSTALL_PATH} COMPONENT RuntimeLibraries) COMPONENT RuntimeLibraries)
endif() endif()
# Generate a quickstart script in the build dir # Generate a quickstart script in the build dir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment