Browse Source

CMakeLists.txt add link pthread library (#754)

pull/755/head
fengdaolong 3 years ago
committed by GitHub
parent
commit
ae041c2133
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      CMakeLists.txt

11
CMakeLists.txt

@ -40,11 +40,18 @@ add_definitions(-DN2N_VERSION="${N2N_VERSION}" -DN2N_OSNAME="${N2N_OSNAME}")
OPTION(BUILD_SHARED_LIBS "BUILD Shared Library" OFF) OPTION(BUILD_SHARED_LIBS "BUILD Shared Library" OFF)
# N2n specific params # N2n specific params
OPTION(N2N_OPTION_USE_PTHREAD "USE PTHREAD Library" OFF)
OPTION(N2N_OPTION_USE_OPENSSL "USE OPENSSL Library" OFF) OPTION(N2N_OPTION_USE_OPENSSL "USE OPENSSL Library" OFF)
OPTION(N2N_OPTION_USE_PCAPLIB "USE PCAP Library" OFF) OPTION(N2N_OPTION_USE_PCAPLIB "USE PCAP Library" OFF)
OPTION(N2N_OPTION_USE_ZSTD "USE ZSTD Library" OFF) OPTION(N2N_OPTION_USE_ZSTD "USE ZSTD Library" OFF)
find_library(PTHREAD_LIB pthread)
if(PTHREAD_LIB)
set(N2N_OPTION_USE_PTHREAD ON)
ADD_DEFINITIONS("-DHAVE_PTHREAD")
endif(PTHREAD_LIB)
if(NOT DEFINED N2N_OPTION_USE_OPENSSL) if(NOT DEFINED N2N_OPTION_USE_OPENSSL)
set(N2N_OPTION_USE_OPENSSL OFF) set(N2N_OPTION_USE_OPENSSL OFF)
endif(NOT DEFINED N2N_OPTION_USE_OPENSSL) endif(NOT DEFINED N2N_OPTION_USE_OPENSSL)
@ -133,6 +140,10 @@ add_library(n2n STATIC
src/curve25519.c) src/curve25519.c)
if(N2N_OPTION_USE_PTHREAD)
target_link_libraries(n2n pthread)
endif(N2N_OPTION_USE_PTHREAD)
if(N2N_OPTION_USE_OPENSSL) if(N2N_OPTION_USE_OPENSSL)
# target_link_libraries(n2n crypto) # target_link_libraries(n2n crypto)
target_link_libraries(n2n ${OPENSSL_LIBRARIES}) target_link_libraries(n2n ${OPENSSL_LIBRARIES})

Loading…
Cancel
Save