Commit b0fc47ef authored by Antoine Regimbeau's avatar Antoine Regimbeau

Merge branch 'develop' into qgis_parameter_status_2

parents 453a86c2 1dfd7482
Pipeline #2206 failed with stages
in 76 minutes and 14 seconds
This diff is collapsed.
......@@ -36,7 +36,7 @@ find_path( AGG_INCLUDE_DIR agg_pixfmt_rgba.h
# handle the QUIETLY and REQUIRED arguments and set AGG_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( Agg DEFAULT_MSG AGG_INCLUDE_DIR )
find_package_handle_standard_args( Agg DEFAULT_MSG AGG_INCLUDE_DIR )
mark_as_advanced( AGG_INCLUDE_DIR )
......
......@@ -41,7 +41,7 @@ find_library(GBENCHMARK_LIBRARY NAMES benchmark)
mark_as_advanced(GBENCHMARK_LIBRARY)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GBENCHMARK
find_package_handle_standard_args(GBENCHMARK
REQUIRED_VARS GBENCHMARK_LIBRARY GBENCHMARK_INCLUDE_DIR
)
#VERSION_VAR GBENCHMARK_VERSION_STRING
......
......@@ -35,6 +35,7 @@
# GLEW_LIBRARY
#
# This whole file could be deleted. Find Packages GLEW can be used now
find_path(
GLEW_INCLUDE_DIR GL/glew.h
DOC "The directory where GL/glew.h resides"
......@@ -57,6 +58,6 @@ if (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
endif()
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW
find_package_handle_standard_args(GLEW
REQUIRED_VARS GLEW_LIBRARY GLEW_INCLUDE_DIR
VERSION_VAR GLEW_VERSION_STRING)
......@@ -78,6 +78,6 @@ IF(GLFW_INCLUDE_DIR AND EXISTS "${GLFW_INCLUDE_DIR}/GLFW/glfw3.h")
ENDIF()
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW
REQUIRED_VARS GLFW_LIBRARY GLFW_INCLUDE_DIR
VERSION_VAR GLFW_VERSION_STRING)
find_package_handle_standard_args(GLFW
REQUIRED_VARS GLFW_LIBRARY GLFW_INCLUDE_DIR
VERSION_VAR GLFW_VERSION_STRING)
......@@ -58,9 +58,8 @@ mark_as_advanced( GEOTIFF_INCLUDE_DIR GEOTIFF_LIBRARY )
# handle the QUIETLY and REQUIRED arguments and set GEOTIFF_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS( GeoTIFF DEFAULT_MSG
GEOTIFF_LIBRARY
GEOTIFF_INCLUDE_DIR)
find_package_handle_standard_args( GeoTIFF DEFAULT_MSG
GEOTIFF_LIBRARY GEOTIFF_INCLUDE_DIR)
if(GEOTIFF_FOUND)
set( GEOTIFF_INCLUDE_DIRS ${GEOTIFF_INCLUDE_DIR} )
......
......@@ -39,7 +39,7 @@ find_library( ICUUC_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set ICUUC_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( ICUUC DEFAULT_MSG ICUUC_LIBRARY ICUUC_INCLUDE_DIR )
find_package_handle_standard_args( ICUUC DEFAULT_MSG ICUUC_LIBRARY ICUUC_INCLUDE_DIR )
mark_as_advanced( ICUUC_INCLUDE_DIR ICUUC_LIBRARY )
......
......@@ -39,7 +39,7 @@ find_library( LTDL_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set LTDL_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( LTDL DEFAULT_MSG LTDL_LIBRARY LTDL_INCLUDE_DIR )
find_package_handle_standard_args( LTDL DEFAULT_MSG LTDL_LIBRARY LTDL_INCLUDE_DIR )
mark_as_advanced( LTDL_INCLUDE_DIR LTDL_LIBRARY )
......
......@@ -46,7 +46,7 @@ mark_as_advanced(
# handle the QUIETLY and REQUIRED arguments and set LIBKML_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
find_package_handle_standard_args(
LibKML
DEFAULT_MSG
LIBKML_INCLUDE_DIR
......
......@@ -121,13 +121,12 @@ endif ()
# handle REQUIRED and QUIET options
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( LibSVM DEFAULT_MSG LIBSVM_LIBRARY
find_package_handle_standard_args( LibSVM DEFAULT_MSG LIBSVM_LIBRARY
_LIBSVM_VERSION_MATCH
LIBSVM_INCLUDE_DIR
LIBSVM_INCLUDE_DIRS
LIBSVM_LIBRARIES
LIBSVM_ROOT_DIR
)
LIBSVM_ROOT_DIR)
mark_as_advanced (
LIBSVM_LIBRARY
......
......@@ -28,7 +28,7 @@
# message("Mercurial version is ${Mercurial_VERSION_HG}")
# endif()
# This file can be deleted as we no longer use mercurial
set(Mercurial_FOUND FALSE)
set(Mercurial_HG_FOUND FALSE)
......
......@@ -66,7 +66,7 @@ find_library( MUPARSER_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set MUPARSER_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( MuParser DEFAULT_MSG MUPARSER_LIBRARY MUPARSER_INCLUDE_DIR )
find_package_handle_standard_args( MuParser DEFAULT_MSG MUPARSER_LIBRARY MUPARSER_INCLUDE_DIR )
mark_as_advanced( MUPARSER_INCLUDE_DIR MUPARSER_LIBRARY )
......
......@@ -60,7 +60,7 @@ find_library( MUPARSERX_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set MUPARSERX_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( MuParserX DEFAULT_MSG MUPARSERX_LIBRARY MUPARSERX_INCLUDE_DIR )
find_package_handle_standard_args( MuParserX DEFAULT_MSG MUPARSERX_LIBRARY MUPARSERX_INCLUDE_DIR )
mark_as_advanced( MUPARSERX_INCLUDE_DIR MUPARSERX_LIBRARY )
......
......@@ -37,7 +37,7 @@ else()
endif()
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( Numpy DEFAULT_MSG NUMPY_INCLUDE_DIR )
find_package_handle_standard_args( Numpy DEFAULT_MSG NUMPY_INCLUDE_DIR )
mark_as_advanced( NUMPY_INCLUDE_DIR )
......
......@@ -139,6 +139,6 @@ if( OPENCV_INCLUDE_DIRS AND OPENCV_LIBRARIES )
endif()
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCV
find_package_handle_standard_args(OpenCV
REQUIRED_VARS OPENCV_core_LIBRARY OPENCV_INCLUDE_DIRS
VERSION_VAR OpenCV_VERSION)
......@@ -58,6 +58,7 @@
# standard install paths.
# Explicit -DVAR=value arguments should still be able to override everything.
# This whole file could be deleted. Find Packages OpenThreads can be used now
find_path(
OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
PATH_SUFFIXES include
......
......@@ -91,7 +91,7 @@ find_library(OSSIM_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set OSSIM_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( Ossim DEFAULT_MSG OSSIM_LIBRARY OSSIM_INCLUDE_DIR )
find_package_handle_standard_args( Ossim DEFAULT_MSG OSSIM_LIBRARY OSSIM_INCLUDE_DIR )
mark_as_advanced( OSSIM_INCLUDE_DIR OSSIM_LIBRARY )
......
......@@ -139,7 +139,7 @@ else()
endif()
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Shark
find_package_handle_standard_args(Shark
REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR ${REQUIRED_CBLAS_LIB}
VERSION_VAR SHARK_VERSION_STRING)
......
......@@ -61,7 +61,7 @@ find_library( TINYXML_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set TINYXML_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( TinyXML DEFAULT_MSG TINYXML_LIBRARY TINYXML_INCLUDE_DIR )
find_package_handle_standard_args( TinyXML DEFAULT_MSG TINYXML_LIBRARY TINYXML_INCLUDE_DIR )
mark_as_advanced( TINYXML_INCLUDE_DIR TINYXML_LIBRARY )
......
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DEPRECATED: Not used in OTB cmake configuration
# DEPRECATED: should be removed after 6.2 release
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS})
unset(OTB_HAS_CXX11 CACHE)
CHECK_CXX_SOURCE_COMPILES("
#ifdef _MSC_VER
#if _MSC_VER <= 1700
#error Compiler is not C++11 compliant
#endif
#else
#if __cplusplus <= 199711L
#error Compiler is not C++11 compliant
#endif
#endif
int main(int argc, char *argv[])
{
return 0;
}
"
OTB_HAS_CXX11 )
CHECK_CXX_SOURCE_COMPILES("
#include <memory>
struct Foo
{
Foo() { }
~Foo() { }
};
int main(int argc, char *argv[])
{
std::unique_ptr<Foo> p(new Foo);
return 0;
}
"
OTB_CXX_HAS_UNIQUE_PTR )
CHECK_CXX_SOURCE_COMPILES("
struct A
{
A() { }
~A() { }
virtual void foo( ) { }
};
struct B : A
{
B() { }
~B() { }
void foo( ) override { }
};
int main(int argc, char *argv[])
{
A* p = new B;
p->foo();
return 0;
}
"
OTB_CXX_HAS_OVERRIDE_SPECIFIER )
CHECK_CXX_SOURCE_COMPILES("
#include <cstddef>
int main(int argc, char *argv[])
{
int *p = nullptr;
return 0;
}
"
OTB_CXX_HAS_NULLPTR )
# try_compile(
# OTB_HAS_CXX11
# ${CMAKE_CURRENT_BINARY_DIR}/CMake
# ${CMAKE_SOURCE_DIR}/CMake/otbTestUniquePtr.cpp
# )
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This should be deleted as it can be done with cmake_host_system_information
# https://cmake.org/cmake/help/v3.10/command/cmake_host_system_information.html?highlight=sse
function(check_sse_features sse_flags )
include(CheckCXXSourceRuns)
include(CheckCXXCompilerFlag)
......
......@@ -18,6 +18,9 @@
# limitations under the License.
#
# This maybe deleted as it might be done with cmake_host_system_information
# https://cmake.org/cmake/help/v3.10/command/cmake_host_system_information.html?highlight=sse
macro(OTB_CHECK_TARGET_SYSTEM_ARCH _RESULT1 _RESULT2)
set(${_RESULT1} "x64")
set(${_RESULT2} TRUE)
......
......@@ -120,13 +120,11 @@ foreach( group ${group_list} )
set( _${group}_on_module_list )
list( LENGTH _${group}_module_list _num_modules )
set( _current_module 0 )
while( ${_current_module} LESS ${_num_modules} )
list( GET _${group}_module_list ${_current_module} _module_name )
if( NOT OTB_MODULE_${_module_name}_EXCLUDE_FROM_DEFAULT )
foreach(module ${_${group}_module_list})
if( NOT OTB_MODULE_${module}_EXCLUDE_FROM_DEFAULT )
list( APPEND _${group}_on_module_list ${_module_name} )
endif()
math( EXPR _current_module "${_current_module} + 1" )
endwhile()
endforeach()
endforeach()
if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
......
......@@ -124,13 +124,6 @@ option(OTB_BUILD_DEFAULT_MODULES "Build the default OTB modules." ON)
option(OTB_BUILD_ALL_MODULES_FOR_TESTS "Build the tests of module dependencies." OFF)
mark_as_advanced(OTB_BUILD_ALL_MODULES_FOR_TESTS)
# To maintain backward compatibility
if(DEFINED OTB_BUILD_ALL_MODULES)
message(WARNING "OTB_BUILD_ALL_MODULES is deprecated, please remove this entry from the CMake "
"cache (edit the CMakeCache.txt file located in the top level of the OTB build "
"tree directly or via the CMake GUI), and use OTB_BUILD_DEFAULT_MODULES instead.")
set(OTB_BUILD_DEFAULT_MODULES ${OTB_BUILD_ALL_MODULES} CACHE BOOL "Build the default OTB modules." FORCE)
endif()
# Provide module selections by groups
include(${OTB_SOURCE_DIR}/CMake/OTBGroups.cmake)
......@@ -227,28 +220,6 @@ list(SORT OTB_MODULES_DISABLED) # Deterministic order.
include(CMake/TopologicalSort.cmake)
topological_sort(OTB_MODULES_ENABLED OTB_MODULE_ _DEPENDS_FOR_SORT)
# TODO : shall we set up CPack ?
# #
# # Set up CPack support
# #
# set(OTB_MODULES_DISABLED_CPACK )
# foreach(m ${OTB_MODULES_DISABLED})
# list(APPEND OTB_MODULES_DISABLED_CPACK "/${m}/")
# endforeach()
# set(CPACK_SOURCE_IGNORE_FILES
# "${OTB_MODULES_DISABLED_CPACK};/\\\\.git")
#
# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Insight Toolkit version ${OTB_VERSION_MAJOR}")
# set(CPACK_PACKAGE_VENDOR "ISC")
# set(CPACK_PACKAGE_VERSION_MAJOR "${OTB_VERSION_MAJOR}")
# set(CPACK_PACKAGE_VERSION_MINOR "${OTB_VERSION_MINOR}")
# set(CPACK_PACKAGE_VERSION_PATCH "${OTB_VERSION_PATCH}")
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "OTB-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}")
# set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
# set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
#
# include(CPack)
# Report what will be built.
set(_enabled_modules "${OTB_MODULES_ENABLED}")
list(SORT _enabled_modules)
......@@ -380,7 +351,9 @@ file(WRITE "${OTB_BINARY_DIR}/OTBTargets.cmake"
"# Generated by CMake, do not edit!")
macro(init_module_vars)
verify_otb_module_is_set()
if( "${otb-module}" STREQUAL "" )
message(FATAL_ERROR "CMake variable otb-module is not set")
endif()
set(${otb-module}-targets OTBTargets)
set(${otb-module}-targets-install "${OTB_INSTALL_PACKAGE_DIR}/OTBTargets.cmake")
set(${otb-module}-targets-build "${OTB_BINARY_DIR}/OTBTargets.cmake")
......
......@@ -33,12 +33,17 @@ if(NOT OTB_VERSION VERSION_GREATER "5.2")
endif()
if(NOT EXISTS ${OTB_CMAKE_DIR}/OTBModuleMacros.cmake)
if(NOT OTB_BUILD_MODULE_AS_STANDALONE)
message(FATAL_ERROR "Modules can only be built against an OTB build tree; they cannot be built against an OTB install tree. You can build your module as a standalone CMake project instead, by activating the BUILD_MODULE_AS_STANDALONE option. Beware that dependency between remote modules will NOT be tracked.")
message(FATAL_ERROR "Modules can only be built against an OTB build tree; "
"they cannot be built against an OTB install tree. You can build "
"your module as a standalone CMake project instead, by activating "
"the BUILD_MODULE_AS_STANDALONE option. Beware that dependency "
"between remote modules will NOT be tracked.")
endif()
endif()
if(OTB_BUILD_MODULE_AS_STANDALONE)
message(STATUS "You are building this module as a standalone CMake project. Beware that dependencies to other remote modules will not be tracked.")
message(STATUS "You are building this module as a standalone CMake project. "
"Beware that dependencies to other remote modules will not be tracked.")
include(OTBStandaloneModuleMacros)
otb_module_impl()
else()
......@@ -86,7 +91,8 @@ else()
set(CMAKE_EXE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}")
option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ${OTB_BUILD_SHARED})
option(BUILD_SHARED_LIBS "Build with shared libraries." ${OTB_BUILD_SHARED})
mark_as_advanced(BUILD_SHARED_LIBS)
# Add the OTB_MODULES_DIR to the CMAKE_MODULE_PATH and then use the binary
# directory for the project to write out new ones to.
......
......@@ -66,7 +66,7 @@ macro( otb_module_headertest _name )
if( NOT ${_name}_THIRD_PARTY
AND EXISTS ${${_name}_SOURCE_DIR}/include
AND PYTHON_EXECUTABLE
AND NOT (PYTHON_VERSION_STRING VERSION_LESS 2.6)
AND NOT (PYTHON_VERSION_STRING VERSION_LESS 3)
AND NOT (${_name} STREQUAL OTBTestKernel)
AND NOT (CMAKE_GENERATOR MATCHES "^Visual Studio 10.*"))
......@@ -96,24 +96,22 @@ macro( otb_module_headertest _name )
# We check to see if the headers are changed. If so, remove the header test
# source files so they are regenerated.
if( ${CMAKE_VERSION} VERSION_GREATER 2.8.6 ) # for string( MD5
set( _headers_list_md5 "${${_name}_BINARY_DIR}/test/CMakeFiles/HeadersList.md5" )
list( SORT _header_files )
string( MD5 _new_md5 "${_header_files}" )
set( _regenerate_sources FALSE )
if( NOT EXISTS "${_headers_list_md5}" )
set( _headers_list_md5 "${${_name}_BINARY_DIR}/test/CMakeFiles/HeadersList.md5" )
list( SORT _header_files )
string( MD5 _new_md5 "${_header_files}" )
set( _regenerate_sources FALSE )
if( NOT EXISTS "${_headers_list_md5}" )
set( _regenerate_sources TRUE )
else()
file( READ "${_headers_list_md5}" _old_md5 )
if( NOT ("${_old_md5}" STREQUAL "${_new_md5}"))
set( _regenerate_sources TRUE )
else()
file( READ "${_headers_list_md5}" _old_md5 )
if( NOT ("${_old_md5}" STREQUAL "${_new_md5}"))
set( _regenerate_sources TRUE )
endif()
endif()
file( WRITE "${_headers_list_md5}" "${_new_md5}" )
if( ${_regenerate_sources} )
file( REMOVE ${_outputs} )
endif()
endif()
file( WRITE "${_headers_list_md5}" "${_new_md5}" )
if( ${_regenerate_sources} )
file( REMOVE ${_outputs} )
endif()
set( _test_num 1 )
foreach( _header_test_src ${_outputs} )
......
......@@ -27,11 +27,8 @@ include(${_OTBModuleMacros_DIR}/OTBModuleDoxygen.cmake)
include(${_OTBModuleMacros_DIR}/OTBModuleHeaderTest.cmake)
include(${_OTBModuleMacros_DIR}/OTBApplicationMacros.cmake)
# With Apple's GGC <=4.2 and LLVM-GCC <=4.2 visibility of template
# don't work. Set the option to off and hide it.
if(APPLE AND CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.3")
set( USE_COMPILER_HIDDEN_VISIBILITY OFF CACHE INTERNAL "" )
elseif(APPLE)
# TODO check if this is still the case:
if(APPLE)
#RK: compiler visibility nor woking on osx with appleclang xcode.
#gcc is a symlink to clang
set( USE_COMPILER_HIDDEN_VISIBILITY OFF CACHE INTERNAL "" )
......@@ -369,8 +366,3 @@ macro(otb_module_target _name)
otb_module_target_install(${_name})
endif()
endmacro()
macro(otb_module_requires_cxx11)
message(WARNING "otb_module_requires_cxx11 is deprecated since OTB version 6.2 which build with c++14 by default. You can safely remove the call to this macro.")
set(OTB_MODULE_${otb-module}_REQUIRES_CXX11 1)
endmacro()
......@@ -138,32 +138,6 @@ EM_ASM(
otb_module_target_label(${KIT}TestDriver)
endmacro()
#-----------------------------------------------------------------------------
# OTB wrapper for add_test that automatically sets the test's LABELS property
# to the value of its containing module.
#
# function(otb_add_test)
# # Add tests with data in the OTBData group.
# ExternalData_add_test(OTBData ${ARGN})
# if("NAME" STREQUAL "${ARGV0}")
# set(_iat_testname ${ARGV1})
# else()
# set(_iat_testname ${ARGV0})
# endif()
# if(otb-module)
# set(_label ${otb-module})
# if(TARGET ${otb-module}-all AND "${ARGN}" MATCHES "DATA{")
# add_dependencies(${otb-module}-all OTBData)
# endif()
# else()
# set(_label ${main_project_name})
# endif()
# set_property(TEST ${_iat_testname} PROPERTY LABELS ${_label})
# endfunction()
#-----------------------------------------------------------------------------
# OTB wrapper for add_test that automatically sets the test's LABELS property
# to the value of its containing module.
......
......@@ -57,6 +57,8 @@ function(check_c_compiler_warning_flags c_flag_var)
set(local_c_flags "")
set(flag_list "${ARGN}")
foreach(flag IN LISTS flag_list)
# This could be replaced by a simple check_c_compiler_flag(<flag> <var>)
# https://cmake.org/cmake/help/v3.10/module/CheckCCompilerFlag.html?highlight=flags
OTB_CHECK_C_COMPILER_FLAG(${flag} C_HAS_WARNING${flag})
if(${C_HAS_WARNING${flag}})
set(local_c_flags "${local_c_flags} ${flag}")
......@@ -70,6 +72,8 @@ function(check_cxx_compiler_warning_flags cxx_flag_var)
set(local_cxx_flags "")
set(flag_list "${ARGN}")
foreach(flag IN LISTS flag_list)
# This could be replaced by a simple check_cxx_compiler_flag(<flag> <var>)
# https://cmake.org/cmake/help/v3.10/module/CheckCXXCompilerFlag.html?highlight=checkcxxcompilerflag
OTB_CHECK_CXX_COMPILER_FLAG(${flag} CXX_HAS_WARNING${flag})
if(${CXX_HAS_WARNING${flag}})
set(local_cxx_flags "${local_cxx_flags} ${flag}")
......@@ -215,6 +219,8 @@ macro(check_compiler_platform_flags)
# BUILD_SHARED_LIBS works as it would on other systems
if(NOT CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS)
if(BUILD_SHARED_LIBS)
# TODO:
# OTB_LIBRARY_BUILD_TYPE is never used!
set(OTB_LIBRARY_BUILD_TYPE "SHARED")
else()
set(OTB_LIBRARY_BUILD_TYPE "STATIC")
......@@ -295,6 +301,8 @@ macro(check_compiler_platform_flags)
if(OTB_USE_SSE_FLAGS)
message(STATUS "SIMD extensions requested with OTB_USE_SSE_FLAGS=${OTB_USE_SSE_FLAGS}")
include(OTBCheckSSEFeatures)
# This should be deleted as it can be done with cmake_host_system_information
# https://cmake.org/cmake/help/v3.10/command/cmake_host_system_information.html?highlight=sse
check_sse_features(OTB_SSE_FLAGS)
if(OTB_SSE_FLAGS)
message(STATUS "Adding '${OTB_SSE_FLAGS}' to OTB_REQUIRED_CXX_FLAGS")
......
......@@ -22,6 +22,8 @@
include(CheckCSourceCompiles)
# This could be replaced by a simple check_c_compiler_flag(<flag> <var>)
# https://cmake.org/cmake/help/v3.10/module/CheckCCompilerFlag.html?highlight=flags
macro (OTB_CHECK_C_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
......
......@@ -42,6 +42,8 @@
include(CheckCXXSourceCompiles)
# This could be replaced by a simple check_cxx_compiler_flag(<flag> <var>)
# https://cmake.org/cmake/help/v3.10/module/CheckCXXCompilerFlag.html?highlight=checkcxxcompilerflag
macro (OTB_CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
......
......@@ -18,14 +18,9 @@
# limitations under the License.
#
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.10.2)
foreach(p
CMP0025 # CMake 3.0
CMP0042 # CMake 3.0
CMP0046 # CMake 3.0
CMP0054 # CMake 3.1
CMP0058 # CMake 3.3
CMP0072 # CMake 3.11
)
if(POLICY ${p})
......@@ -59,6 +54,10 @@ include(ExternalProject)
#mantis: 1193
if(APPLE)
# https://cmake.org/cmake/help/v3.10/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.html
# By default it contains the standard directories for the current system. It
# is not intended to be modified by the project, use CMAKE_FRAMEWORK_PATH
# for this.
set(CMAKE_SYSTEM_FRAMEWORK_PATH "" CACHE PATH "" FORCE)
endif()
......@@ -88,7 +87,7 @@ mark_as_advanced(OTB_APPLICATIONS_NAME_LIST)
set(OTB_CMAKE_DIR ${OTB_SOURCE_DIR}/CMake)
set(CMAKE_MODULE_PATH ${OTB_CMAKE_DIR} ${CMAKE_MODULE_PATH})
include (SourceStatus)
include(SourceStatus)
include(PreventInSourceBuilds)
include(PreventInBuildInstalls)
include(OTBModuleMacros)
......@@ -110,6 +109,8 @@ if ( OTB_WRAP_PYTHON AND ( ${PYTHON_VERSION_MAJOR} EQUAL 2 ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
......@@ -179,15 +180,6 @@ endif()
#convert path to native for reconfiguring otbcli.bat.in
file(TO_NATIVE_PATH "${OTB_INSTALL_APP_DIR}" OTB_INSTALL_APP_DIR_NATIVE)
# Override CMake's built-in add_* commands: assign LABELS to tests and targets
# automatically. Depends on the CMake variable otb-module being set to the
# "current" module when add_* is called.
macro(verify_otb_module_is_set)
if("" STREQUAL "${otb-module}")
message(FATAL_ERROR "CMake variable otb-module is not set")
endif()
endmacro()
#-----------------------------------------------------------------------------
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
......@@ -217,10 +209,16 @@ endmacro()
# TODO : handle shared libs on windows
option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON)
mark_as_advanced(BUILD_SHARED_LIBS)
# The following variable can be deleted and replace by BUILD_SHARED_LIBS
# in otbConfigure.h.in
set(OTB_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
if(MSVC)
option(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "Build OTB with shared libraries." ON)
mark_as_advanced(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS)
set(OTB_CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ${CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS})
else()
set(OTB_CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
......@@ -235,6 +233,7 @@ endif()
option(OTB_USE_OPENMP "Add openmp compiler and linker flags" OFF)
option(OTB_USE_SSE_FLAGS "Enable SIMD optimizations (hardware dependent)." ON)
mark_as_advanced(OTB_USE_SSE_FLAGS)
include(OTBSetStandardCompilerFlags)
#---------------------------------------------------------------
......@@ -268,10 +267,6 @@ if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
endif()
set(OTB_MODULES_DIR "${OTB_BINARY_DIR}/${OTB_INSTALL_PACKAGE_DIR}/Modules")
#-----------------------------------------------------------------------------
# OTB uses KWStyle for checking the coding style
#include(${OTB_SOURCE_DIR}/Utilities/KWStyle/KWStyle.cmake)
#-----------------------------------------------------------------------------
# By default, OTB does not build the Examples that are illustrated in the Software Guide
option(BUILD_EXAMPLES "Build the Examples directory." OFF)
......@@ -481,18 +476,6 @@ configure_file(
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
# #-----------------------------------------------------------------------------
# # Packaging options for Windows packages
# if(WIN32 OR CMAKE_CROSSCOMPILING)
# option(GENERATE_PACKAGE "Generate OTB package" OFF)
# option(GENERATE_XDK "Generate XDK for OTB development" OFF)
# if(GENERATE_PACKAGE OR GENERATE_XDK)
# set(MXE_TARGET_DIR "" CACHE PATH "path to mxe directory")
# set(PACKAGE_OTB_SRC_DIR ${OTB_SOURCE_DIR})
# add_subdirectory(${OTB_SOURCE_DIR}/SuperBuild/Packaging ${CMAKE_BINARY_DIR}/Packaging)
# endif() # (GENERATE_PACKAGE OR GENERATE_XDK)
# endif() # (WIN32 OR CMAKE_CROSSCOMPILING)
#-----------------------------------------------------------------------------
#macro to put a fixed space between key, value in summary
macro(get_white_spaces var res)
......@@ -538,18 +521,8 @@ foreach(otb_option
message("${otb_option} ${spaces} = ${${otb_option}}")
endforeach()
# set(modules_list_for_summary "${OTB_MODULES_ENABLED}")
# list(SORT modules_list_for_summary)
# string(REPLACE ";" " " modules_list_for_summary "${modules_list_for_summary}")
# message("OTB_MODULES_ENABLED = ${modules_list_for_summary}")
# unset(modules_list_for_summary)
list(REMOVE_ITEM option_list "OTB_USE_6S" "OTB_USE_SIFTFAST" "OTB_USE_QT")
foreach(item ${option_list})
if(NOT ${item})
list(REMOVE_ITEM option_list "${item}" )
endif()
endforeach()
# Cleaning option_list as we are using a new one now
unset(option_list)
#To report non-optional dependencies inside summary
list(APPEND option_list Boost)
......
......@@ -19,8 +19,6 @@
#
set(CTEST_PROJECT_NAME "OTB")
set(CTEST_NIGHTLY_START_TIME "20:00:00 CEST")
set(CTEST_DROP_METHOD "https")