diff --git a/CMake/OTBApplicationMacros.cmake b/CMake/OTBApplicationMacros.cmake index 40bd282c972d4b82abe14d91cb846dab7dea771d..8004325c1e49af2911894fd54566888cb9dc98f0 100644 --- a/CMake/OTBApplicationMacros.cmake +++ b/CMake/OTBApplicationMacros.cmake @@ -116,7 +116,10 @@ macro(otb_test_application) $<TARGET_FILE_DIR:otbapp_${TESTAPPLICATION_APP}> ${TESTAPPLICATION_OPTIONS} -testenv ${TESTAPPLICATION_TESTENVOPTIONS}) - # Be sure that the ${otb-module}-all target triggers the build of commandline launcher and testdriver - add_dependencies(${otb-module}-all otbApplicationLauncherCommandLine) - add_dependencies(${otb-module}-all otbTestDriver) -endmacro() \ No newline at end of file + + if(otb-module) + # Be sure that the ${otb-module}-all target triggers the build of commandline launcher and testdriver + add_dependencies(${otb-module}-all otbApplicationLauncherCommandLine) + add_dependencies(${otb-module}-all otbTestDriver) + endif() +endmacro() diff --git a/Examples/Application/CMakeLists.txt b/Examples/Application/CMakeLists.txt index 02c4cabe3085c1919a345fe7098d4b3d1e191b97..e87366a71e7cbcb9b00adf1d05ca4ed8b5d7c5b6 100644 --- a/Examples/Application/CMakeLists.txt +++ b/Examples/Application/CMakeLists.txt @@ -1,8 +1,9 @@ project(ApplicationExamples) -add_executable(ApplicationExample ApplicationExample.cxx) -target_link_libraries(ApplicationExample ${OTB_LIBRARIES}) - +otb_create_application( + NAME ApplicationExample + SOURCES ApplicationExample.cxx + LINK_LIBRARIES ${OTB_LIBRARIES}) if(BUILD_TESTING) add_subdirectory(test)