Skip to content
Snippets Groups Projects
Commit 1a80f091 authored by Julien Michel's avatar Julien Michel
Browse files

COMP: Check for C++11 support at configuration time. Exits with fatal error...

COMP: Check for C++11 support at configuration time. Exits with fatal error for modules explicitly requiring C++11
parent 3f648a16
No related branches found
No related tags found
No related merge requests found
......@@ -2,4 +2,4 @@
try_compile(OTB_IS_UNIQUE_PTR_DEFINED ${CMAKE_CURRENT_BINARY_DIR}/CMake ${CMAKE_SOURCE_DIR}/CMake/otbTestUniquePtr.cpp)
try_compile(OTB_IS_OVERRIDE_DEFINED ${CMAKE_CURRENT_BINARY_DIR}/CMake ${CMAKE_SOURCE_DIR}/CMake/otbTestUniquePtr.cpp)
try_compile(OTB_IS_NULLPTR_DEFINED ${CMAKE_CURRENT_BINARY_DIR}/CMake ${CMAKE_SOURCE_DIR}/CMake/otbTestUniquePtr.cpp)
try_compile(OTB_HAS_CXX11 ${CMAKE_CURRENT_BINARY_DIR}/CMake ${CMAKE_SOURCE_DIR}/CMake/otbTestUniquePtr.cpp)
......@@ -324,3 +324,9 @@ macro(otb_module_target _name)
otb_module_target_install(${_name})
endif()
endmacro()
macro(otb_module_requires_cxx11)
if(NOT ${OTB_HAS_CXX11})
message(FATAL_ERROR "Module ${otb-module} requires C++11 support. Consider adding --std=c++11 to your compiler flags.")
endif()
endmacro()
#if __cplusplus <= 199711L
#error Compiler is not C++11 compliant
#endif
int main(int argc, char *argv[])
{
return 0;
}
......@@ -442,6 +442,7 @@ foreach(otb_option
CMAKE_BUILD_TYPE
CMAKE_C_FLAGS
CMAKE_CXX_FLAGS
OTB_HAS_CXX11
${option_list}
OTB_WRAP_PYTHON
OTB_WRAP_JAVA
......
......@@ -9,4 +9,7 @@ otb_module(OTBShark
"${DOCUMENTATION}"
)
otb_module_requires_cxx11()
otb_module_activation_option("Enable SHARK dependent modules" OFF)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment