Skip to content

Commit 7959c04

Browse files
committed
Add OpenSSL dependency to CMakeLists.txt files for C and C++ projects
- Include `find_package(OpenSSL REQUIRED)` to ensure OpenSSL is available. - Link the `bittorrent` executable with OpenSSL's Crypto library across all relevant CMakeLists.txt files in compiled_starters, solutions, and starter_templates.
1 parent 8c989de commit 7959c04

File tree

6 files changed

+27
-3
lines changed

6 files changed

+27
-3
lines changed

compiled_starters/c/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ file(GLOB_RECURSE SOURCE_FILES src/*.c src/*.h)
66

77
set(CMAKE_C_STANDARD 23) # Enable the C23 standard
88

9+
find_package(OpenSSL REQUIRED)
10+
911
add_executable(bittorrent ${SOURCE_FILES})
12+
13+
target_link_libraries(bittorrent PRIVATE OpenSSL::Crypto)

compiled_starters/cpp/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ set(CMAKE_CXX_STANDARD 23) # Enable the C++23 standard
66

77
file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp)
88

9-
add_executable(bittorrent ${SOURCE_FILES})
9+
find_package(OpenSSL REQUIRED)
10+
11+
add_executable(bittorrent ${SOURCE_FILES})
12+
13+
target_link_libraries(bittorrent PRIVATE OpenSSL::Crypto)

solutions/c/01-ns2/code/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ file(GLOB_RECURSE SOURCE_FILES src/*.c src/*.h)
66

77
set(CMAKE_C_STANDARD 23) # Enable the C23 standard
88

9+
find_package(OpenSSL REQUIRED)
10+
911
add_executable(bittorrent ${SOURCE_FILES})
12+
13+
target_link_libraries(bittorrent PRIVATE OpenSSL::Crypto)

solutions/cpp/01-ns2/code/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ set(CMAKE_CXX_STANDARD 23) # Enable the C++23 standard
66

77
file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp)
88

9-
add_executable(bittorrent ${SOURCE_FILES})
9+
find_package(OpenSSL REQUIRED)
10+
11+
add_executable(bittorrent ${SOURCE_FILES})
12+
13+
target_link_libraries(bittorrent PRIVATE OpenSSL::Crypto)

starter_templates/c/code/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ file(GLOB_RECURSE SOURCE_FILES src/*.c src/*.h)
66

77
set(CMAKE_C_STANDARD 23) # Enable the C23 standard
88

9+
find_package(OpenSSL REQUIRED)
10+
911
add_executable(bittorrent ${SOURCE_FILES})
12+
13+
target_link_libraries(bittorrent PRIVATE OpenSSL::Crypto)

starter_templates/cpp/code/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ set(CMAKE_CXX_STANDARD 23) # Enable the C++23 standard
66

77
file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp)
88

9-
add_executable(bittorrent ${SOURCE_FILES})
9+
find_package(OpenSSL REQUIRED)
10+
11+
add_executable(bittorrent ${SOURCE_FILES})
12+
13+
target_link_libraries(bittorrent PRIVATE OpenSSL::Crypto)

0 commit comments

Comments
 (0)