Commit 7b56741b authored by Rashad Kanavath's avatar Rashad Kanavath

BUG: redefine somme vars from ../CMakeLists.txt only if standalone build

parent 91082e8d
......@@ -8,17 +8,86 @@ if(NOT PROJECT_NAME)
project(OTBExamples)
endif()
#check if this is a standalone build?
if(PROJECT_NAME STREQUAL "OTBExamples")
set(BUILD_TESTING ON)
include(CTest)
if(BUILD_TESTING)
include(CTest)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMake/OTBManageLargeInputPaths.cmake)
endif()
##### check if standalone project ######
########################## shamelessly copied from OTB/CMakeLists.txt ##########################
#Generate cmake variables with a set of largeinput data used in tests
set(BASELINE ${OTB_DATA_ROOT}/Baseline/OTB/Images)
set(BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB/Files)
set(INPUTDATA ${OTB_DATA_ROOT}/Input)
set(TEMP ${CMAKE_BINARY_DIR}/Testing/Temporary)
set(EXAMPLEDATA ${OTB_DATA_ROOT}/Examples)
set(OTBAPP_BASELINE ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Images)
set(OTBAPP_BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Files)
set(NOTOL 0.0)
set(EPSILON_1 0.1)
set(EPSILON_2 0.01)
set(EPSILON_3 0.001)
set(EPSILON_4 0.0001)
set(EPSILON_5 0.00001)
set(EPSILON_6 0.000001)
set(EPSILON_7 0.0000001)
set(EPSILON_8 0.00000001)
set(EPSILON_9 0.000000001)
set(EPSILON_10 0.0000000001)
set(EPSILON_11 0.00000000001)
set(EPSILON_12 0.000000000001)
set(EPSILON_13 0.0000000000001)
set(EPSILON_14 0.00000000000001)
set(EPSILON_15 0.000000000000001)
#-----------------------------------------------------------------------------
# OTB wrapper for add_test that automatically sets the test's LABELS property
# to the value of its containing module.
#
function(otb_add_test)
set(largeinput_regex "LARGEINPUT{([^;{}\r\n]*)}")
set(_depends_on_largeinput OFF)
foreach(arg IN LISTS ARGN)
if("x${arg}" MATCHES "${largeinput_regex}")
string(REGEX REPLACE "${largeinput_regex}" "\\1" largeinput_relative_path "${arg}")
set(_fullpath "${OTB_DATA_LARGEINPUT_ROOT}/${largeinput_relative_path}")
list(APPEND _out_arg ${_fullpath})
set(_depends_on_largeinput ON)
else()
list(APPEND _out_arg ${arg})
endif()
endforeach()
if (_depends_on_largeinput AND NOT OTB_DATA_USE_LARGEINPUT)
return()
endif()
add_test(${_out_arg})
if("NAME" STREQUAL "${ARGV0}")
set(_iat_testname ${ARGV1})
else()
set(_iat_testname ${ARGV0})
endif()
if(otb-module)
set(_label ${otb-module})
else()
set(_label ${main_project_name})
endif()
set_property(TEST ${_iat_testname} PROPERTY LABELS ${_label})
endfunction()
########################## end copied from OTB/CMakeLists.txt ##########################
set(OTB_BUILD_DEFAULT_MODULES ON)
else()
if(NOT OTB_BUILD_DEFAULT_MODULES)
message(FATAL_ERROR "BUILD_EXAMPLES requires OTB_BUILD_DEFAULT_MODULES to be ON")
endif()
if(NOT OTB_BUILD_DEFAULT_MODULES)
message(FATAL_ERROR "BUILD_EXAMPLES requires OTB_BUILD_DEFAULT_MODULES to be ON")
endif()
# We also need to prevent any OTB_USE_XXX option to be OFF (except mapnik and openjpeg)
# For now we parse module activation list and test if option is ON. If not the cmake configuration stop.
#TODO We should provide a better mechanism here wich will deactivate only examples required by deactivated options.
......@@ -34,76 +103,6 @@ include(${OTB_USE_FILE})
message(STATUS "Found OTB: ${OTB_USE_FILE}")
set(OTB_TEST_DRIVER otbTestDriver)
########################## shamelessly copied from OTB/CMakeLists.txt ##########################
#Generate cmake variables with a set of largeinput data used in tests
set(BASELINE ${OTB_DATA_ROOT}/Baseline/OTB/Images)
set(BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB/Files)
set(INPUTDATA ${OTB_DATA_ROOT}/Input)
set(TEMP ${OTB_BINARY_DIR}/Testing/Temporary)
set(EXAMPLEDATA ${OTB_DATA_ROOT}/Examples)
set(OTBAPP_BASELINE ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Images)
set(OTBAPP_BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Files)
set(NOTOL 0.0)
set(EPSILON_1 0.1)
set(EPSILON_2 0.01)
set(EPSILON_3 0.001)
set(EPSILON_4 0.0001)
set(EPSILON_5 0.00001)
set(EPSILON_6 0.000001)
set(EPSILON_7 0.0000001)
set(EPSILON_8 0.00000001)
set(EPSILON_9 0.000000001)
set(EPSILON_10 0.0000000001)
set(EPSILON_11 0.00000000001)
set(EPSILON_12 0.000000000001)
set(EPSILON_13 0.0000000000001)
set(EPSILON_14 0.00000000000001)
set(EPSILON_15 0.000000000000001)
#-----------------------------------------------------------------------------
# OTB wrapper for add_test that automatically sets the test's LABELS property
# to the value of its containing module.
#
function(otb_add_test)
set(largeinput_regex "LARGEINPUT{([^;{}\r\n]*)}")
set(_depends_on_largeinput OFF)
foreach(arg IN LISTS ARGN)
if("x${arg}" MATCHES "${largeinput_regex}")
string(REGEX REPLACE "${largeinput_regex}" "\\1" largeinput_relative_path "${arg}")
set(_fullpath "${OTB_DATA_LARGEINPUT_ROOT}/${largeinput_relative_path}")
list(APPEND _out_arg ${_fullpath})
set(_depends_on_largeinput ON)
else()
list(APPEND _out_arg ${arg})
endif()
endforeach()
if (_depends_on_largeinput AND NOT OTB_DATA_USE_LARGEINPUT)
return()
endif()
add_test(${_out_arg})
if("NAME" STREQUAL "${ARGV0}")
set(_iat_testname ${ARGV1})
else()
set(_iat_testname ${ARGV0})
endif()
if(otb-module)
set(_label ${otb-module})
else()
set(_label ${main_project_name})
endif()
set_property(TEST ${_iat_testname} PROPERTY LABELS ${_label})
endfunction()
########################## end copied from OTB/CMakeLists.txt ##########################
if(OTBApplicationEngine_LOADED)
add_subdirectory(Application)
endif()
......
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