Skip to content

Commit 6e5fdb0

Browse files
authored
Merge pull request #1191 from Exiv2/0.27_cxx_standard2
Enforce cxx_std_98 in samples, unit_tests, and exiv2 application
2 parents f0dee57 + c51a8aa commit 6e5fdb0

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

cmake/compilerFlags.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
2222

2323

2424
if (COMPILER_IS_GCC OR COMPILER_IS_CLANG)
25+
# On Solaris target_compile_features(${application} PRIVATE cxx_std_98) fails to set this flag
26+
if ( CMAKE_HOST_SOLARIS )
27+
add_compile_options(-std=gnu++98)
28+
endif()
2529

2630
# This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0
2731
if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) )

samples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ list(APPEND APPLICATIONS remotetest)
120120
# ******************************************************************************
121121
foreach(application ${APPLICATIONS})
122122
target_link_libraries(${application} PRIVATE exiv2lib)
123+
target_compile_features(${application} PRIVATE cxx_std_98)
123124
if( EXIV2_ENABLE_PNG )
124125
target_link_libraries( ${application} PRIVATE ${ZLIB_LIBRARIES} )
125126
endif()

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ if(EXIV2_BUILD_EXIV2_COMMAND)
256256
getopt.cpp getopt.hpp
257257
utils.cpp utils.hpp
258258
)
259+
target_compile_features(exiv2 PRIVATE cxx_std_98)
259260

260261
set_target_properties( exiv2 PROPERTIES
261262
COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}

unitTests/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ foreach(source IN LISTS exiv2lib_SOURCES exiv2lib_int_SOURCES)
1717
endif()
1818
endforeach()
1919

20-
add_executable(unit_tests mainTestRunner.cpp
21-
gtestwrapper.h
20+
add_executable(unit_tests
21+
mainTestRunner.cpp
2222
test_DateValue.cpp
2323
test_TimeValue.cpp
2424
test_XmpKey.cpp
@@ -33,6 +33,7 @@ add_executable(unit_tests mainTestRunner.cpp
3333
test_slice.cpp
3434
test_tiffheader.cpp
3535
test_types.cpp
36+
gtestwrapper.h
3637
${unit_tests_exiv2lib_SOURCES}
3738
)
3839

@@ -41,6 +42,7 @@ target_compile_definitions(unit_tests
4142
exiv2lib_STATIC
4243
TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data"
4344
)
45+
target_compile_features(unit_tests PRIVATE cxx_std_98)
4446

4547
if (exiv2lib_COMPILE_DEFINITIONS)
4648
target_compile_definitions(unit_tests PRIVATE ${exiv2lib_COMPILE_DEFINITIONS})

0 commit comments

Comments
 (0)