Skip to content

Commit fb16ab1

Browse files
committed
raise minimum required CMake version from 2.8 to 3.8
1 parent 5bd6862 commit fb16ab1

File tree

23 files changed

+130
-88
lines changed

23 files changed

+130
-88
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required(VERSION 2.8)
1+
# We might support earlier versions, too, but try to use a recent one.
2+
cmake_minimum_required(VERSION 3.8)
3+
4+
project(sha256)
35

46
# Recurse into subdirectory for sha256 executable.
57
add_subdirectory (sha256)

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog for sha256
22

3+
## Version NEXT (2022-11-??)
4+
- The minimum required CMake version to build the program is raised to
5+
CMake 3.8.
6+
37
## Version 1.4 (2015-08-06)
48
- add option to use SHA-384 instead of SHA-256
59

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ not exist, the program quits.
6262

6363
### Prerequisites
6464

65-
To build sha256 from source you need a C++ compiler and CMake 2.8 or later.
65+
To build sha256 from source you need a C++ compiler with support for C++11 and
66+
CMake 3.8 or later.
6667
It also helps to have Git, a distributed version control system, on your build
6768
system to get the latest source code directly from the Git repository.
6869

sha256/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
# We might support earlier versions, too, but try to use a recent version.
2+
cmake_minimum_required (VERSION 3.8)
33

44
project(sha256)
55

6-
# enable C++11 support
7-
add_definitions(-std=c++0x)
8-
96
set(sha256_sources
107
../libstriezel/common/StringUtils.cpp
118
../libstriezel/filesystem/file.cpp
@@ -25,10 +22,14 @@ set(sha256_sources
2522
../libstriezel/hash/sha512/sha512.cpp
2623
main.cpp)
2724

28-
if (CMAKE_COMPILER_IS_GNUCC)
25+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
2926
add_definitions (-Wall -O3 -fexceptions)
30-
endif (CMAKE_COMPILER_IS_GNUCC)
3127

32-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
28+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
29+
endif ()
30+
31+
# enable C++11 support
32+
set(CMAKE_CXX_STANDARD 11)
33+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3334

3435
add_executable(sha256 ${sha256_sources})

tests/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.8)
32

43
# Recurse into subdirectory for SHA-1 test (160 bit digest).
54
add_subdirectory (sha160)

tests/sha160/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.8)
32

43
# Recurse into subdirectory for simple test.
54
add_subdirectory (secure-hashing-examples)

tests/sha160/secure-hashing-examples/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary simple SHA-1 test
54
project(test_simple_sha1)
@@ -11,10 +10,15 @@ set(test_simple_sha1_src
1110
../../../libstriezel/hash/sha1/sha1.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
1613

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
14+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
15+
add_definitions(-Wall -O2 -fexceptions)
16+
17+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
18+
endif ()
19+
20+
set(CMAKE_CXX_STANDARD 11)
21+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1822

1923
add_executable(test_simple_sha1 ${test_simple_sha1_src})
2024

tests/sha224/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.8)
32

43
# Recurse into subdirectory for simple test.
54
add_subdirectory (secure-hashing-examples)

tests/sha224/additional-buffer/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for additional SHA-224 tests
54
project(test_additional_buffer_sha224)
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha224_src
1110
../../../libstriezel/hash/sha256/MessageSource.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_definitions(-Wall -O2 -fexceptions)
1615

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
16+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
17+
endif ()
18+
19+
set(CMAKE_CXX_STANDARD 11)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1821

1922
add_executable(test_additional_buffer_sha224 ${test_additional_buffer_sha224_src})
2023

tests/sha224/additional-file/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for additional SHA-224 tests
54
project(test_additional_sha224)
@@ -14,10 +13,14 @@ set(test_additional_sha224_src
1413
../../../libstriezel/hash/sha256/MessageSource.cpp
1514
main.cpp)
1615

17-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
18-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
16+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
17+
add_definitions(-Wall -O2 -fexceptions)
1918

20-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
19+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
20+
endif ()
21+
22+
set(CMAKE_CXX_STANDARD 11)
23+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2124

2225
add_executable(test_additional_sha224 ${test_additional_sha224_src})
2326

tests/sha224/secure-hashing-examples/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for simple SHA-224 test
54
project(test_simple_sha224)
@@ -11,10 +10,14 @@ set(test_simple_sha224_src
1110
../../../libstriezel/hash/sha224/sha224.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_definitions(-Wall -O2 -fexceptions)
1615

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
16+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
17+
endif ()
18+
19+
set(CMAKE_CXX_STANDARD 11)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1821

1922
add_executable(test_simple_sha224 ${test_simple_sha224_src})
2023

tests/sha256/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.8)
32

43
# Recurse into subdirectory for simple test.
54
add_subdirectory (secure-hashing-examples)

tests/sha256/additional-buffer/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for additional SHA-256 tests
54
project(test_additional_buffer_sha256)
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha256_src
1110
../../../libstriezel/hash/sha256/sha256.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_definitions(-Wall -O2 -fexceptions)
1615

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
16+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
17+
endif ()
18+
19+
set(CMAKE_CXX_STANDARD 11)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1821

1922
add_executable(test_additional_buffer_sha256 ${test_additional_buffer_sha256_src})
2023

tests/sha256/additional-file/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for additional SHA-256 tests
54
project(test_additional_sha256)
@@ -14,10 +13,14 @@ set(test_additional_sha256_src
1413
../../../libstriezel/hash/sha256/sha256.cpp
1514
main.cpp)
1615

17-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
18-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
16+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
17+
add_definitions(-Wall -O2 -fexceptions)
1918

20-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
19+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
20+
endif ()
21+
22+
set(CMAKE_CXX_STANDARD 11)
23+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2124

2225
add_executable(test_additional_sha256 ${test_additional_sha256_src})
2326

tests/sha256/secure-hashing-examples/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for simple SHA-256 test
54
project(test_simple_sha256)
@@ -11,10 +10,14 @@ set(test_simple_sha256_src
1110
../../../libstriezel/hash/sha256/sha256.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_definitions(-Wall -O2 -fexceptions)
1615

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
16+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
17+
endif ()
18+
19+
set(CMAKE_CXX_STANDARD 11)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1821

1922
add_executable(test_simple_sha256 ${test_simple_sha256_src})
2023

tests/sha384/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.8)
32

43
# Recurse into subdirectory for simple test.
54
add_subdirectory (secure-hashing-examples)

tests/sha384/additional-buffer/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for additional SHA-384 buffer tests
54
project(test_additional_buffer_sha384)
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha384_src
1110
../../../libstriezel/hash/sha512/MessageSource.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_definitions(-Wall -O2 -fexceptions)
1615

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
16+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
17+
endif ()
18+
19+
set(CMAKE_CXX_STANDARD 11)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1821

1922
add_executable(test_additional_buffer_sha384 ${test_additional_buffer_sha384_src})
2023

tests/sha384/additional-file/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for additional SHA-384 tests
54
project(test_additional_sha384)
@@ -13,10 +12,14 @@ set(test_additional_sha384_src
1312
../../../libstriezel/hash/sha512/MessageSource.cpp
1413
main.cpp)
1514

16-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
17-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
15+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
16+
add_definitions(-Wall -O2 -fexceptions)
1817

19-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
18+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
19+
endif ()
20+
21+
set(CMAKE_CXX_STANDARD 11)
22+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2023

2124
add_executable(test_additional_sha384 ${test_additional_sha384_src})
2225

tests/sha384/secure-hashing-examples/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for simple SHA-384 test
54
project(test_simple_sha384)
@@ -11,10 +10,14 @@ set(test_simple_sha384_src
1110
../../../libstriezel/hash/sha384/sha384.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_definitions(-Wall -O2 -fexceptions)
1615

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
16+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
17+
endif ()
18+
19+
set(CMAKE_CXX_STANDARD 11)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1821

1922
add_executable(test_simple_sha384 ${test_simple_sha384_src})
2023

tests/sha512/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.8)
32

43
# Recurse into subdirectory for simple test.
54
add_subdirectory (secure-hashing-examples)

tests/sha512/additional-buffer/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# We might support earlier versions, too, but it's only tested with 2.8.9.
2-
cmake_minimum_required (VERSION 2.8)
1+
cmake_minimum_required (VERSION 3.8)
32

43
# binary for additional SHA-512 tests with buffer
54
project(test_additional_buffer_sha512)
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha512_src
1110
../../../libstriezel/hash/sha512/MessageSource.cpp
1211
main.cpp)
1312

14-
# We use a C++11 feature in the code, so enable C++0x a.k.a. C++11.
15-
add_definitions(-Wall -O2 -fexceptions -std=c++0x)
13+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
14+
add_definitions(-Wall -O2 -fexceptions)
1615

17-
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
16+
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
17+
endif ()
18+
19+
set(CMAKE_CXX_STANDARD 11)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1821

1922
add_executable(test_additional_buffer_sha512 ${test_additional_buffer_sha512_src})
2023

0 commit comments

Comments
 (0)