Skip to content

Commit bab5e29

Browse files
committed
Since the only reason we used C++17 was to get std::optional, we downgrade to C++11 in CMakeLists. This commit imports version 3.2.0 of optional-lite.
1 parent d8865ee commit bab5e29

File tree

4 files changed

+1726
-6
lines changed

4 files changed

+1726
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ add_library (cryptolens STATIC ${SRC})
2828
target_link_libraries (cryptolens ${LIBS})
2929
target_include_directories (cryptolens PRIVATE "${cryptolens_SOURCE_DIR}/include/cryptolens")
3030
target_include_directories (cryptolens PUBLIC "${cryptolens_SOURCE_DIR}/include")
31-
set_property (TARGET cryptolens PROPERTY CXX_STANDARD 17)
31+
set_property (TARGET cryptolens PROPERTY CXX_STANDARD 11)
3232
set_property (TARGET cryptolens PROPERTY CXX_STANDARD_REQURED ON)
3333

3434
if (${CRYPTOLENS_BUILD_TESTS})

examples/unix/cmake/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ add_subdirectory ("../../.." "cryptolens-cpp")
1212

1313
add_executable(example_activate ../example_activate.cpp)
1414
target_link_libraries(example_activate cryptolens)
15-
set_property(TARGET example_activate PROPERTY CXX_STANDARD 17)
15+
set_property(TARGET example_activate PROPERTY CXX_STANDARD 11)
1616
set_property(TARGET example_activate PROPERTY CXX_STANDARD_REQURED ON)
1717

1818
add_executable(example_create_trial_key ../example_create_trial_key.cpp)
1919
target_link_libraries(example_create_trial_key cryptolens)
20-
set_property(TARGET example_create_trial_key PROPERTY CXX_STANDARD 17)
20+
set_property(TARGET example_create_trial_key PROPERTY CXX_STANDARD 11)
2121
set_property(TARGET example_create_trial_key PROPERTY CXX_STANDARD_REQURED ON)
2222

2323
add_executable(example_external ../example_external.cpp)
2424
target_link_libraries(example_external cryptolens)
25-
set_property(TARGET example_external PROPERTY CXX_STANDARD 17)
25+
set_property(TARGET example_external PROPERTY CXX_STANDARD 11)
2626
set_property(TARGET example_external PROPERTY CXX_STANDARD_REQURED ON)
2727

2828
add_executable(example_floating ../example_floating.cpp)
2929
target_link_libraries(example_floating cryptolens)
30-
set_property(TARGET example_floating PROPERTY CXX_STANDARD 17)
30+
set_property(TARGET example_floating PROPERTY CXX_STANDARD 11)
3131
set_property(TARGET example_floating PROPERTY CXX_STANDARD_REQURED ON)
3232

3333
add_executable(example_offline ../example_offline.cpp)
3434
target_link_libraries(example_offline cryptolens)
35-
set_property(TARGET example_offline PROPERTY CXX_STANDARD 17)
35+
set_property(TARGET example_offline PROPERTY CXX_STANDARD 11)
3636
set_property(TARGET example_offline PROPERTY CXX_STANDARD_REQURED ON)

include/cryptolens/imports/std/optional

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
#pragma once
22

3+
#if __cplusplus < 201703L
4+
5+
#include "../../../../third_party/optional-lite/optional.hpp"
6+
7+
namespace cryptolens_io {
8+
9+
namespace v20190401 {
10+
11+
template<typename T>
12+
using optional = ::nonstd::optional<T>;
13+
14+
using ::nonstd::make_optional;
15+
using ::nonstd::nullopt;
16+
17+
} // namespace v20190401
18+
19+
} // namespace cryptolens_io
20+
21+
#else
22+
323
#include <optional>
424

525
namespace cryptolens_io {
@@ -16,6 +36,8 @@ using std::nullopt;
1636

1737
} // namespace cryptolens_io
1838

39+
#endif
40+
1941
namespace cryptolens_io {
2042

2143
namespace latest {

0 commit comments

Comments
 (0)