Commit f47211a0 authored by Guillaume Pasero's avatar Guillaume Pasero

ADD: detect c++11 features for muParserX

parent 30604e6a
include(CheckCXXSourceRuns)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS})
unset(CMAKE_REQUIRED_DEFINES)
# check if unique_ptr is defined
file(READ ${CMAKE_SOURCE_DIR}/CMake/otbTestUniquePtr.cpp
OTB_TEST_UNIQUE_PTR_SOURCE)
check_cxx_source_runs(
"${OTB_TEST_UNIQUE_PTR_SOURCE}"
OTB_IS_UNIQUE_PTR_DEFINED
)
# check if override keyword is known
file(READ ${CMAKE_SOURCE_DIR}/CMake/otbTestOverride.cpp
OTB_TEST_OVERRIDE_SOURCE)
check_cxx_source_runs(
"${OTB_TEST_OVERRIDE_SOURCE}"
OTB_IS_OVERRIDE_DEFINED
)
# check if nullptr keyword is known
file(READ ${CMAKE_SOURCE_DIR}/CMake/otbTestNullPtr.cpp
OTB_TEST_NULLPTR_SOURCE)
check_cxx_source_runs(
"${OTB_TEST_NULLPTR_SOURCE}"
OTB_IS_NULLPTR_DEFINED
)
unset(CMAKE_REQUIRED_FLAGS)
int main(int argc, char *argv[])
{
int *p = nullptr;
return 0;
}
#include <iostream>
struct A
{
A() {}
~A() {}
virtual void foo() { std::cout << "A::foo()\n"; }
};
struct B : A
{
B() {}
~B() {}
void foo() override { std::cout << "B::foo()\n"; }
};
int main(int argc, char *argv[])
{
A* p = new B;
p->foo();
return 0;
}
#include <iostream>
#include <memory>
struct Foo
{
Foo() { std::cout << "Constructor\n"; }
~Foo() { std::cout << "Destructor\n"; }
};
int main(int argc, char *argv[])
{
std::unique_ptr<Foo> p(new Foo);
return 0;
}
......@@ -157,6 +157,9 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}")
# detect some C++11 keywords
#include(OTBCheckCpp11Keywords)
# TODO BUILD_TESTING is created by default by CTest.cmake, and is ON by default.
option(BUILD_TESTING "Build the testing tree." OFF)
......
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