Skip to content

Commit e572ecb

Browse files
committed
CMake: Allow building without examples
Building examples with newer GCC encounters the error: | libp2p_echo_server.cpp: In function 'bool isInsecure(int, char**)': | libp2p_echo_server.cpp:22:22: error: 'template<class ValueType, int FirstDimension, int ...RestDimensions> class gsl::multi_span' is deprecated [-Werror=deprecated-declarations] | 22 | auto args = gsl::multi_span<char *>(argv, argc); | | ^~~~~~~~~~ | cc1plus: some warnings being treated as errors TODO: Disable -Werror for examples
1 parent 6f75672 commit e572ecb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ project(libp2p C CXX)
1919
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2020

2121
option(TESTING "Build tests" ON)
22+
option(BUILD_EXAMPLES "Build examples" ON)
2223
option(CLANG_FORMAT "Enable clang-format target" ON)
2324
option(CLANG_TIDY "Enable clang-tidy checks during compilation" OFF)
2425
option(COVERAGE "Enable generation of coverage info" OFF)
@@ -91,7 +92,10 @@ include_directories(
9192
)
9293

9394
add_subdirectory(src)
94-
add_subdirectory(example)
95+
96+
if (BUILD_EXAMPLES)
97+
add_subdirectory(example)
98+
endif()
9599

96100
if(TESTING)
97101
enable_testing()

0 commit comments

Comments
 (0)