Adding option -DEXIV2_BUILD_USE_C++11

v0.27.3
clanmills 5 years ago
parent 4da0a57ec0
commit 63a13e8620

@ -9,7 +9,6 @@ project(exiv2 # use TWEAK to categorize the build
# 0.27.3.19 = RC1 Not for release # 0.27.3.19 = RC1 Not for release
LANGUAGES CXX C LANGUAGES CXX C
) )
include(cmake/mainSetup.cmake REQUIRED) include(cmake/mainSetup.cmake REQUIRED)
# options and their default values # options and their default values
@ -29,8 +28,9 @@ option( EXIV2_ENABLE_SSH "USE Libssh for SshIo (WEBREADY)"
option( EXIV2_BUILD_SAMPLES "Build sample applications" ON ) option( EXIV2_BUILD_SAMPLES "Build sample applications" ON )
option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON ) option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON )
option( EXIV2_BUILD_UNIT_TESTS "Build unit tests" OFF ) option( EXIV2_BUILD_UNIT_TESTS "Build unit tests" ON )
option( EXIV2_BUILD_DOC "Add 'doc' target to generate documentation" OFF ) option( EXIV2_BUILD_DOC "Add 'doc' target to generate documentation" OFF )
option( EXIV2_BUILD_USE_C++11 "Use the C++11 compiler" OFF )
# Only intended to be used by Exiv2 developers/contributors # Only intended to be used by Exiv2 developers/contributors
option( EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF ) option( EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF )

@ -1,5 +1,9 @@
# These flags applies to exiv2lib, the applications, and to the xmp code # These flags applies to exiv2lib, the applications, and to the xmp code
if ( EXIV2_BUILD_USE_C++11 )
set(CMAKE_CXX_STANDARD 11)
endif()
if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
set(COMPILER_IS_GCC ON) set(COMPILER_IS_GCC ON)
@ -22,10 +26,6 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
if (COMPILER_IS_GCC OR COMPILER_IS_CLANG) if (COMPILER_IS_GCC OR COMPILER_IS_CLANG)
# On Solaris target_compile_features(${application} PRIVATE cxx_std_98) fails to set this flag
if ( CMAKE_HOST_SOLARIS )
add_compile_options(-std=gnu++98)
endif()
# This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0 # This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0
if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) ) if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) )
@ -58,7 +58,6 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
# This seems to be causing issues in the Fedora_MinGW GitLab job # This seems to be causing issues in the Fedora_MinGW GitLab job
#add_compile_options(-fasynchronous-unwind-tables) #add_compile_options(-fasynchronous-unwind-tables)
if ( EXIV2_TEAM_USE_SANITIZERS ) if ( EXIV2_TEAM_USE_SANITIZERS )
# ASAN is available in gcc from 4.8 and UBSAN from 4.9 # ASAN is available in gcc from 4.8 and UBSAN from 4.9
# ASAN is available in clang from 3.1 and UBSAN from 3.3 # ASAN is available in clang from 3.1 and UBSAN from 3.3
@ -90,6 +89,10 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
endif() endif()
endif() endif()
endif() endif()
if ( EXIV2_BUILD_USE_C++11 )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated")
endif()
endif () endif ()
# http://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake # http://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake

@ -49,6 +49,9 @@ if ( EXIV2_ENABLE_EXTERNAL_XMP )
else() else()
OptionOutput( "XMP metadata support: " EXIV2_ENABLE_XMP ) OptionOutput( "XMP metadata support: " EXIV2_ENABLE_XMP )
endif() endif()
if ( EXIV2_BUILD_USE_C++11 )
OptionOutput("Use C++11: " EXIV2_BUILD_USE_C++11 )
endif()
OptionOutput( "Native language support: " EXIV2_ENABLE_NLS ) OptionOutput( "Native language support: " EXIV2_ENABLE_NLS )
OptionOutput( "Conversion of Windows XP tags: " EXIV2_ENABLE_PRINTUCS2 ) OptionOutput( "Conversion of Windows XP tags: " EXIV2_ENABLE_PRINTUCS2 )
OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA ) OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA )

@ -93,5 +93,15 @@ typedef int pid_t;
#endif #endif
////////////////////////////////////// //////////////////////////////////////
// https://softwareengineering.stackexchange.com/questions/291141/how-to-handle-design-changes-for-auto-ptr-deprecation-in-c11
#if __cplusplus >= 201103L
#include <memory>
#include <sys/types.h>
#include <unistd.h>
template <typename T>
using auto_ptr = std::unique_ptr<T>;
#else
using std::auto_ptr;
#endif
#endif // _CONFIG_H_ #endif // _CONFIG_H_

@ -120,7 +120,6 @@ list(APPEND APPLICATIONS remotetest)
# ****************************************************************************** # ******************************************************************************
foreach(application ${APPLICATIONS}) foreach(application ${APPLICATIONS})
target_link_libraries(${application} PRIVATE exiv2lib) target_link_libraries(${application} PRIVATE exiv2lib)
target_compile_features(${application} PRIVATE cxx_std_98)
if( EXIV2_ENABLE_PNG ) if( EXIV2_ENABLE_PNG )
target_link_libraries( ${application} PRIVATE ${ZLIB_LIBRARIES} ) target_link_libraries( ${application} PRIVATE ${ZLIB_LIBRARIES} )
endif() endif()

@ -91,10 +91,6 @@ generate_export_header(exiv2lib
STATIC_DEFINE exiv2lib_STATIC STATIC_DEFINE exiv2lib_STATIC
) )
target_compile_features(exiv2lib_int PRIVATE cxx_std_98)
target_compile_features(exiv2lib PRIVATE cxx_std_98)
# Conditional addition of sources to library targets # Conditional addition of sources to library targets
# --------------------------------------------------------- # ---------------------------------------------------------

@ -80,7 +80,6 @@ typedef short nlink_t;
// ***************************************************************************** // *****************************************************************************
// class member definitions // class member definitions
namespace Exiv2 { namespace Exiv2 {
BasicIo::~BasicIo() BasicIo::~BasicIo()
{ {
} }

@ -42,7 +42,6 @@ target_compile_definitions(unit_tests
exiv2lib_STATIC exiv2lib_STATIC
TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data" TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data"
) )
target_compile_features(unit_tests PRIVATE cxx_std_98)
if (exiv2lib_COMPILE_DEFINITIONS) if (exiv2lib_COMPILE_DEFINITIONS)
target_compile_definitions(unit_tests PRIVATE ${exiv2lib_COMPILE_DEFINITIONS}) target_compile_definitions(unit_tests PRIVATE ${exiv2lib_COMPILE_DEFINITIONS})

Loading…
Cancel
Save