File tree Expand file tree Collapse file tree 23 files changed +130
-88
lines changed Expand file tree Collapse file tree 23 files changed +130
-88
lines changed Original file line number Diff line number Diff line change 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 )
3
5
4
6
# Recurse into subdirectory for sha256 executable.
5
7
add_subdirectory (sha256 )
Original file line number Diff line number Diff line change 1
1
# ChangeLog for sha256
2
2
3
+ ## Version NEXT (2022-11-??)
4
+ - The minimum required CMake version to build the program is raised to
5
+ CMake 3.8.
6
+
3
7
## Version 1.4 (2015-08-06)
4
8
- add option to use SHA-384 instead of SHA-256
5
9
Original file line number Diff line number Diff line change @@ -62,7 +62,8 @@ not exist, the program quits.
62
62
63
63
### Prerequisites
64
64
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.
66
67
It also helps to have Git, a distributed version control system, on your build
67
68
system to get the latest source code directly from the Git repository.
68
69
Original file line number Diff line number Diff line change 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 )
3
3
4
4
project (sha256 )
5
5
6
- # enable C++11 support
7
- add_definitions (-std=c++0x )
8
-
9
6
set (sha256_sources
10
7
../libstriezel/common/StringUtils.cpp
11
8
../libstriezel/filesystem/file.cpp
@@ -25,10 +22,14 @@ set(sha256_sources
25
22
../libstriezel/hash/sha512/sha512.cpp
26
23
main.cpp )
27
24
28
- if (CMAKE_COMPILER_IS_GNUCC )
25
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
29
26
add_definitions (-Wall -O3 -fexceptions )
30
- endif (CMAKE_COMPILER_IS_GNUCC )
31
27
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 )
33
34
34
35
add_executable (sha256 ${sha256_sources} )
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# Recurse into subdirectory for SHA-1 test (160 bit digest).
5
4
add_subdirectory (sha160 )
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# Recurse into subdirectory for simple test.
5
4
add_subdirectory (secure-hashing-examples )
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary simple SHA-1 test
5
4
project (test_simple_sha1 )
@@ -11,10 +10,15 @@ set(test_simple_sha1_src
11
10
../../../libstriezel/hash/sha1/sha1.cpp
12
11
main.cpp )
13
12
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 )
16
13
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 )
18
22
19
23
add_executable (test_simple_sha1 ${test_simple_sha1_src} )
20
24
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# Recurse into subdirectory for simple test.
5
4
add_subdirectory (secure-hashing-examples )
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for additional SHA-224 tests
5
4
project (test_additional_buffer_sha224 )
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha224_src
11
10
../../../libstriezel/hash/sha256/MessageSource.cpp
12
11
main.cpp )
13
12
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 )
16
15
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 )
18
21
19
22
add_executable (test_additional_buffer_sha224 ${test_additional_buffer_sha224_src} )
20
23
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for additional SHA-224 tests
5
4
project (test_additional_sha224 )
@@ -14,10 +13,14 @@ set(test_additional_sha224_src
14
13
../../../libstriezel/hash/sha256/MessageSource.cpp
15
14
main.cpp )
16
15
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 )
19
18
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 )
21
24
22
25
add_executable (test_additional_sha224 ${test_additional_sha224_src} )
23
26
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for simple SHA-224 test
5
4
project (test_simple_sha224 )
@@ -11,10 +10,14 @@ set(test_simple_sha224_src
11
10
../../../libstriezel/hash/sha224/sha224.cpp
12
11
main.cpp )
13
12
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 )
16
15
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 )
18
21
19
22
add_executable (test_simple_sha224 ${test_simple_sha224_src} )
20
23
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# Recurse into subdirectory for simple test.
5
4
add_subdirectory (secure-hashing-examples )
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for additional SHA-256 tests
5
4
project (test_additional_buffer_sha256 )
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha256_src
11
10
../../../libstriezel/hash/sha256/sha256.cpp
12
11
main.cpp )
13
12
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 )
16
15
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 )
18
21
19
22
add_executable (test_additional_buffer_sha256 ${test_additional_buffer_sha256_src} )
20
23
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for additional SHA-256 tests
5
4
project (test_additional_sha256 )
@@ -14,10 +13,14 @@ set(test_additional_sha256_src
14
13
../../../libstriezel/hash/sha256/sha256.cpp
15
14
main.cpp )
16
15
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 )
19
18
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 )
21
24
22
25
add_executable (test_additional_sha256 ${test_additional_sha256_src} )
23
26
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for simple SHA-256 test
5
4
project (test_simple_sha256 )
@@ -11,10 +10,14 @@ set(test_simple_sha256_src
11
10
../../../libstriezel/hash/sha256/sha256.cpp
12
11
main.cpp )
13
12
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 )
16
15
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 )
18
21
19
22
add_executable (test_simple_sha256 ${test_simple_sha256_src} )
20
23
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# Recurse into subdirectory for simple test.
5
4
add_subdirectory (secure-hashing-examples )
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for additional SHA-384 buffer tests
5
4
project (test_additional_buffer_sha384 )
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha384_src
11
10
../../../libstriezel/hash/sha512/MessageSource.cpp
12
11
main.cpp )
13
12
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 )
16
15
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 )
18
21
19
22
add_executable (test_additional_buffer_sha384 ${test_additional_buffer_sha384_src} )
20
23
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for additional SHA-384 tests
5
4
project (test_additional_sha384 )
@@ -13,10 +12,14 @@ set(test_additional_sha384_src
13
12
../../../libstriezel/hash/sha512/MessageSource.cpp
14
13
main.cpp )
15
14
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 )
18
17
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 )
20
23
21
24
add_executable (test_additional_sha384 ${test_additional_sha384_src} )
22
25
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for simple SHA-384 test
5
4
project (test_simple_sha384 )
@@ -11,10 +10,14 @@ set(test_simple_sha384_src
11
10
../../../libstriezel/hash/sha384/sha384.cpp
12
11
main.cpp )
13
12
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 )
16
15
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 )
18
21
19
22
add_executable (test_simple_sha384 ${test_simple_sha384_src} )
20
23
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# Recurse into subdirectory for simple test.
5
4
add_subdirectory (secure-hashing-examples )
Original file line number Diff line number Diff line change 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 )
3
2
4
3
# binary for additional SHA-512 tests with buffer
5
4
project (test_additional_buffer_sha512 )
@@ -11,10 +10,14 @@ set(test_additional_buffer_sha512_src
11
10
../../../libstriezel/hash/sha512/MessageSource.cpp
12
11
main.cpp )
13
12
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 )
16
15
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 )
18
21
19
22
add_executable (test_additional_buffer_sha512 ${test_additional_buffer_sha512_src} )
20
23
You can’t perform that action at this time.
0 commit comments