Skip to content

Commit

Permalink
Merge pull request #1446 from dcoeurjo/removingCPP11checks
Browse files Browse the repository at this point in the history
Removing C++11 checks
  • Loading branch information
dcoeurjo authored Jan 7, 2020
2 parents 76b61b1 + 53e7ca6 commit e043b0e
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 202 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
- CSS edit to enhance the readability of code snippets (David
Coeurjolly [#1438](https://github.com/DGtal-team/DGtal/pull/1438))

- *Build*
- Removing the homemade CPP11 checks, using cmake macro instead
(David Coeurjolly, [#1446](https://github.com/DGtal-team/DGtal/pull/1446))


# DGtal 1.0

## New Features / Critical Changes
Expand Down
26 changes: 0 additions & 26 deletions cmake/CheckCPP11.cmake

This file was deleted.

33 changes: 0 additions & 33 deletions cmake/CheckDGtalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,6 @@ if ( ZLIB_FOUND )
SET(DGtalLibDependencies ${DGtalLibDependencies} ${ZLIB_LIBRARIES})
endif( ZLIB_FOUND )


# -----------------------------------------------------------------------------
# Check some CPP11 features in the compiler
# -----------------------------------------------------------------------------
MESSAGE(STATUS "Checking C++11 compatibility:")
INCLUDE(CheckCPP11)
IF (CPP11_COMPATIBLE)
IF (NOT CPP11_COMPATIBLE_FLAG_SET_BY_USER)
IF (NOT MSVC)
set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS ON)
MESSAGE(STATUS " c++11 enabled by cmake. ")
ENDIF()
ENDIF()
MESSAGE(STATUS "OK.")
ELSE()
MESSAGE(FATAL_ERROR "Your compiler does not support C++11. Please specify another C++ compiler.")
ENDIF()


# -----------------------------------------------------------------------------
# Fixing Catch issue for C++11 and old GCC
# -----------------------------------------------------------------------------
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# require at least gcc 4.7
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
add_definitions("-DCATCH_CONFIG_CPP11_NO_IS_ENUM")
message(STATUS "Patching Catch for gcc < 4.7")
endif()
endif()


# -----------------------------------------------------------------------------
# Setting librt dependency on Linux
# -----------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions cmake/Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ foreach(p LIB BIN INCLUDE DATA)
endif()
endforeach()



# -----------------------------------------------------------------------------
# CPP11
# -----------------------------------------------------------------------------
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED TRUE)

# -----------------------------------------------------------------------------
# Visual Studio : to distinguish between debug and release lib
# -----------------------------------------------------------------------------
Expand Down
16 changes: 0 additions & 16 deletions cmake/DGtalConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,6 @@ IF (@COLOR_WITH_ALPHA_ARITH_DGTAL@)
ADD_DEFINITIONS(-DCOLOR_WITH_ALPHA_ARITH)
ENDIF(@COLOR_WITH_ALPHA_ARITH_DGTAL@)

# Set c++11 flag only if needed.
# When user or compiler have not set any std flag.
try_compile( CPP11_COMPATIBLE_FLAG_SET_BY_USER
${CMAKE_BINARY_DIR}/CMakeTmp
"@DGTAL_CMAKE_DIR@/cpp11_check.cpp"
CMAKE_FLAGS "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
OUTPUT_VARIABLE OUTPUT
)

IF (NOT CPP11_COMPATIBLE_FLAG_SET_BY_USER)
set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS ON)
MESSAGE(STATUS " c++11 enabled by cmake. ")
ENDIF()

IF(@GMP_FOUND_DGTAL@)
ADD_DEFINITIONS("-DWITH_GMP ")
SET(WITH_GMP 1)
Expand Down
6 changes: 2 additions & 4 deletions cmake/DGtalConfigGenerator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ export(TARGETS DGtal FILE "${PROJECT_BINARY_DIR}/DGtalLibraryDepends.cmake")
set(DGTAL_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")
set(DGTAL_LIB_DIR "${PROJECT_BINARY_DIR}/src")
set(DGTAL_CMAKE_DIR "${PROJECT_BINARY_DIR}")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

configure_file(${PROJECT_SOURCE_DIR}/cmake/DGtalConfig.cmake.in
"${PROJECT_BINARY_DIR}/DGtalConfig.cmake" @ONLY)

configure_file(${PROJECT_SOURCE_DIR}/cmake/DGtalConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/DGtalConfigVersion.cmake" @ONLY)
# Copy also the cpp11_check.cpp for the build tree.
file(COPY ${PROJECT_SOURCE_DIR}/cmake/src/cpp11/cpp11_check.cpp
DESTINATION ${PROJECT_BINARY_DIR})

# Install the export set for use with the install-tree
install(EXPORT DGtalLibraryDepends DESTINATION
Expand All @@ -39,5 +38,4 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/DGtalConfigVersion.cmake.in
install(FILES
"${PROJECT_BINARY_DIR}/InstallFiles/DGtalConfig.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/DGtalConfigVersion.cmake"
"${PROJECT_SOURCE_DIR}/cmake/src/cpp11/cpp11_check.cpp"
DESTINATION "${DGTAL_CMAKE_DIR}" COMPONENT dev)
12 changes: 0 additions & 12 deletions cmake/src/ITKcpp11Bug/CMakeLists.txt

This file was deleted.

38 changes: 0 additions & 38 deletions cmake/src/ITKcpp11Bug/itkcpp11.cpp

This file was deleted.

73 changes: 0 additions & 73 deletions cmake/src/cpp11/cpp11_check.cpp

This file was deleted.

0 comments on commit e043b0e

Please sign in to comment.