Skip to content

Commit 671387e

Browse files
f-michautfmichaut-diff
authored andcommitted
Use find_package for SSL lib
1 parent 710d55f commit 671387e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Author Francois Michaut
55
##
66
## Started on Sun Aug 28 19:26:51 2022 Francois Michaut
7-
## Last update Wed May 10 08:24:03 2023 Francois Michaut
7+
## Last update Thu Nov 23 18:30:41 2023 Francois Michaut
88
##
99
## CMakeLists.txt : CMake to build the CppSockets library
1010
##
@@ -28,7 +28,8 @@ add_library(cppsockets
2828
source/TlsSocket.cpp
2929
)
3030

31-
target_link_libraries(cppsockets ssl)
31+
find_package(OpenSSL 3.0 COMPONENTS SSL)
32+
target_link_libraries(cppsockets OpenSSL::SSL)
3233

3334
add_custom_target(test
3435
COMMAND ${CMAKE_COMMAND} --log-level=WARNING

source/Socket.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
** Author Francois Michaut
55
**
66
** Started on Sat Jan 15 01:27:40 2022 Francois Michaut
7-
** Last update Tue Nov 14 20:03:40 2023 Francois Michaut
7+
** Last update Thu Nov 23 23:13:35 2023 Francois Michaut
88
**
99
** Socket.cpp : Protable C++ socket class implementation
1010
*/
@@ -42,9 +42,11 @@ namespace CppSockets {
4242
{
4343
socklen_t len = sizeof(int);
4444

45-
Socket::getsockopt(sockfd, SOL_SOCKET, SO_DOMAIN, &m_domain, &len);
4645
Socket::getsockopt(sockfd, SOL_SOCKET, SO_TYPE, &m_type, &len);
46+
#ifndef OS_APPLE
47+
Socket::getsockopt(sockfd, SOL_SOCKET, SO_DOMAIN, &m_domain, &len);
4748
Socket::getsockopt(sockfd, SOL_SOCKET, SO_PROTOCOL, &m_protocol, &len);
49+
#endif
4850
}
4951

5052
// TODO: more error handling arround is_connected == false and sockfd == INVALID in IO calls

0 commit comments

Comments
 (0)