Permalink
Browse files

#193 Dropped support for boot::shared_ptr<>, enabled C++11 support in…

… CMake
  • Loading branch information...
vincent-richard committed Apr 1, 2018
1 parent ed825ba commit 8564b2f8b0d563a2c328a09916e9e4e3def5978f
Showing with 14 additions and 679 deletions.
  1. +6 −84 CMakeLists.txt
  2. +0 −1 cmake/cmake-cxx11/.gitignore
  3. +0 −7 cmake/cmake-cxx11/MERGE-TODO
  4. +0 −142 cmake/cmake-cxx11/Modules/CheckCXX11Features.cmake
  5. +0 −8 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-__func__.cpp
  6. +0 −12 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-auto.cpp
  7. +0 −7 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-auto_fail_compile.cpp
  8. +0 −8 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-auto_ret_type.cpp
  9. +0 −21 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-class_override_final.cpp
  10. +0 −25 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-class_override_final_fail_compile.cpp
  11. +0 −19 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-constexpr.cpp
  12. +0 −11 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-cstdint.cpp
  13. +0 −10 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-decltype.cpp
  14. +0 −27 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-initializer_list.cpp
  15. +0 −5 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-lambda.cpp
  16. +0 −7 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-long_long.cpp
  17. +0 −6 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-nullptr.cpp
  18. +0 −6 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-nullptr_fail_compile.cpp
  19. +0 −26 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-regex.cpp
  20. +0 −57 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-rvalue-references.cpp
  21. +0 −14 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-sizeof_member.cpp
  22. +0 −9 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-sizeof_member_fail.cpp
  23. +0 −5 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-static_assert.cpp
  24. +0 −5 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-static_assert_fail_compile.cpp
  25. +0 −23 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-variadic_templates.cpp
  26. +0 −33 cmake/cmake-cxx11/Tests/Module/CXX11Features/CMakeLists.txt
  27. +0 −57 cmake/cmake-cxx11/Tests/Module/CXX11Features/cxx11features.cxx
  28. +0 −2 doc/book/building.tex
  29. +8 −42 src/vmime/types.hpp
View
@@ -12,7 +12,7 @@
# http://www.cmake.org
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR)
INCLUDE(cmake/Utils.cmake)
@@ -68,6 +68,11 @@ SET(VMIME_API_VERSION ${VMIME_API_VERSION_CURRENT}.${VMIME_API_VERSION_REVISION}
# Set base name
SET(VMIME_LIBRARY_NAME vmime)
# Enable C++11
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
# Source files
FILE(
GLOB_RECURSE
@@ -795,89 +800,6 @@ ELSE()
ENDIF()
##############################################################################
# Language features
# C++11
INCLUDE(cmake/cmake-cxx11/Modules/CheckCXX11Features.cmake)
# Smart pointers
#
# If a C++11-compliant compiler is available and supports std::shared_ptr<>,
# use the standard implementation. Else, use boost::shared_ptr<>.
# In any case, let the user override the choice with VMIME_SHARED_PTR_USE_CXX
# and VMIME_SHARED_PTR_USE_BOOST variables.
CHECK_CXX_SOURCE_COMPILES(
"
#include <memory>
struct A { int foo; };
int main() {
std::shared_ptr <A> a = std::make_shared <A>();
return 0;
}
"
VMIME_HAS_CXX11_SHARED_PTR
)
IF(NOT VMIME_SHARED_PTR_USE_CXX AND NOT VMIME_SHARED_PTR_USE_BOOST)
IF(CXX11_COMPILER_FLAGS AND VMIME_HAS_CXX11_SHARED_PTR)
# If std::shared_ptr<> is available, use it by default
SET(VMIME_SHARED_PTR_USE_CXX_DEFAULT ON)
SET(VMIME_SHARED_PTR_USE_BOOST_DEFAULT OFF)
ELSE()
# Else, set default to boost::shared_ptr<>
SET(VMIME_SHARED_PTR_USE_CXX_DEFAULT OFF)
SET(VMIME_SHARED_PTR_USE_BOOST_DEFAULT ON)
ENDIF()
ENDIF()
OPTION(
VMIME_SHARED_PTR_USE_CXX
"Use standard std::shared_ptr<> (requires a C++11 compiler)"
${VMIME_SHARED_PTR_USE_CXX_DEFAULT}
)
OPTION(
VMIME_SHARED_PTR_USE_BOOST
"Use boost::shared_ptr<> (requires Boost)"
${VMIME_SHARED_PTR_USE_BOOST_DEFAULT}
)
IF(VMIME_SHARED_PTR_USE_CXX AND VMIME_SHARED_PTR_USE_BOOST)
MESSAGE(FATAL_ERROR "Options VMIME_SHARED_PTR_USE_CXX and VMIME_SHARED_PTR_USE_BOOST are mutually exclusive (select one or the other, but not both!)")
ENDIF()
IF(VMIME_SHARED_PTR_USE_CXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()
MESSAGE(STATUS "Checking support for shared_ptr<>: built-in (C++11)")
ELSEIF(VMIME_SHARED_PTR_USE_BOOST)
# Depends on Boost library if C++11 is not supported
FIND_PACKAGE(Boost)
IF(Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
ELSE()
MESSAGE(FATAL_ERROR "Boost library is required for shared_ptr<>, unless you compile using C++11")
ENDIF()
MESSAGE(STATUS "Checking support for shared_ptr<>: boost library")
ELSE()
MESSAGE(FATAL_ERROR "No implementation for shared_ptr<> was selected/found")
ENDIF()
##############################################################################
# Platform

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 8564b2f

Please sign in to comment.