2023-12-20 13:36:59 +01:00
cmake_minimum_required ( VERSION 3.14 )
2023-06-20 15:53:07 +02:00
set ( CMAKE_CONFIGURATION_TYPES "Release;Debug;ASAN" )
2023-06-20 15:53:06 +02:00
project ( openvpn )
# This CMake file implements building OpenVPN with CMAKE
#
# Note that this is *NOT* the official way to build openvpn on anything
# other than Windows/mingw despite working on other platforms too. You will need
# to add -DUNSUPPORTED_BUILDS=true to build on non Windows platforms.
#
# This cmake also makes a few assertions like lzo, lz4 being used
# and OpenSSL having version 1.1.1+ and generally does not offer the same
# configurability like autoconf
2023-06-29 23:56:08 +02:00
find_package ( PkgConfig REQUIRED )
include ( CheckSymbolExists )
include ( CheckIncludeFiles )
include ( CheckCCompilerFlag )
2023-07-12 11:55:29 +02:00
include ( CheckLinkerFlag OPTIONAL )
2023-06-29 23:56:08 +02:00
include ( CheckTypeSize )
include ( CheckStructHasMember )
include ( CTest )
2023-06-20 15:53:06 +02:00
option ( UNSUPPORTED_BUILDS "Allow unsupported builds" OFF )
if ( NOT WIN32 AND NOT ${ UNSUPPORTED_BUILDS } )
message ( FATAL_ERROR "Note: on Unix platform the official and supported build method is using autoconfig. CMake based build should be only used for Windows and internal testing/development." )
endif ( )
2023-07-03 17:39:25 +02:00
if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/config.h" )
message ( FATAL_ERROR "The top level source directory has a config.h file. Note that you can't mix in-tree autoconfig builds with out-of-tree cmake builds." )
endif ( )
2023-06-20 15:53:06 +02:00
option ( MBED "BUILD with mbed" OFF )
2023-12-11 18:05:49 +01:00
set ( MBED_INCLUDE_PATH "" CACHE STRING "Path to mbed TLS include directory" )
set ( MBED_LIBRARY_PATH "" CACHE STRING "Path to mbed library directory" )
2023-06-20 15:53:06 +02:00
option ( WOLFSSL "BUILD with wolfSSL" OFF )
2023-06-20 15:53:07 +02:00
option ( ENABLE_LZ4 "BUILD with lz4" ON )
option ( ENABLE_LZO "BUILD with lzo" ON )
option ( ENABLE_PKCS11 "BUILD with pkcs11-helper" ON )
option ( USE_WERROR "Treat compiler warnings as errors (-Werror)" ON )
set ( PLUGIN_DIR /usr/local/lib/openvpn/plugins CACHE FILEPATH "Location of the plugin directory" )
2023-06-20 15:53:06 +02:00
2023-12-20 13:36:59 +01:00
# Create machine readable compile commands
2024-01-17 14:49:29 +01:00
option ( ENABLE_COMPILE_COMMANDS "Generate compile_commands.json and a symlink for clangd to find it" OFF )
if ( ENABLE_COMPILE_COMMANDS )
if ( EXISTS ${ CMAKE_CURRENT_SOURCE_DIR } /build AND NOT IS_SYMLINK ${ CMAKE_CURRENT_SOURCE_DIR } /build )
message ( FATAL_ERROR "The top level source directory contains a 'build' file or directory. Please remove or rename it. CMake creates a symlink with that name during build." )
endif ( )
set ( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
add_custom_target (
s y m l i n k - b u i l d - d i r A L L
$ { C M A K E _ C O M M A N D } - E c r e a t e _ s y m l i n k $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / b u i l d
)
endif ( )
2023-12-20 13:36:59 +01:00
2023-06-20 15:53:06 +02:00
# AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN
set ( CMAKE_C_FLAGS_ASAN
2023-06-20 15:53:07 +02:00
" - f s a n i t i z e = a d d r e s s , u n d e f i n e d - f n o - s a n i t i z e - r e c o v e r = a l l - f n o - o p t i m i z e - s i b l i n g - c a l l s - f s a n i t i z e - a d d r e s s - u s e - a f t e r - s c o p e - f n o - o m i t - f r a m e - p o i n t e r - g - O 1 "
C A C H E S T R I N G " F l a g s u s e d b y t h e C c o m p i l e r d u r i n g A d d r e s s S a n i t i z e r b u i l d s . "
F O R C E )
2023-06-20 15:53:06 +02:00
set ( CMAKE_CXX_FLAGS_ASAN
2023-06-20 15:53:07 +02:00
" - f s a n i t i z e = a d d r e s s , u n d e f i n e d - f n o - s a n i t i z e - r e c o v e r = a l l - f n o - o p t i m i z e - s i b l i n g - c a l l s - f s a n i t i z e - a d d r e s s - u s e - a f t e r - s c o p e - f n o - o m i t - f r a m e - p o i n t e r - g - O 1 "
C A C H E S T R I N G " F l a g s u s e d b y t h e C + + c o m p i l e r d u r i n g A d d r e s s S a n i t i z e r b u i l d s . "
F O R C E )
2023-06-20 15:53:06 +02:00
if ( MSVC )
2023-06-20 15:53:07 +02:00
add_definitions ( -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS )
if ( USE_WERROR )
add_compile_options ( /WX )
endif ( )
add_compile_options (
/ M P
/ W 2
/ s d l
/ Q s p e c t r e
/ g u a r d : c f
/ F C
/ Z H : S H A _ 2 5 6
" $ < $ < C O N F I G : R e l e a s e > : / G L > "
" $ < $ < C O N F I G : R e l e a s e > : / O i > "
" $ < $ < C O N F I G : R e l e a s e > : / G y > "
" $ < $ < C O N F I G : R e l e a s e > : / Z i > "
)
add_link_options (
2023-06-20 15:53:09 +02:00
/ B r e p r o
2023-06-20 15:53:07 +02:00
" $ < $ < C O N F I G : R e l e a s e > : / L T C G : i n c r e m e n t a l > "
" $ < $ < C O N F I G : R e l e a s e > : / D E B U G : F U L L > "
" $ < $ < C O N F I G : R e l e a s e > : / O P T : R E F > "
" $ < $ < C O N F I G : R e l e a s e > : / O P T : I C F > "
)
if ( ${ CMAKE_GENERATOR_PLATFORM } STREQUAL "x64" OR ${ CMAKE_GENERATOR_PLATFORM } STREQUAL "x86" )
add_link_options ( "$<$<CONFIG:Release>:/CETCOMPAT>" )
endif ( )
2023-06-20 15:53:06 +02:00
else ( )
2023-06-29 23:56:08 +02:00
add_compile_options ( -Wall -Wuninitialized )
check_c_compiler_flag ( -Wno-stringop-truncation NoStringOpTruncation )
if ( ${ NoStringOpTruncation } )
add_compile_options ( -Wno-stringop-truncation )
endif ( )
2023-06-20 15:53:06 +02:00
# We are not ready for this
2023-06-20 15:53:07 +02:00
#add_compile_options(-Wconversion -Wno-sign-conversion -Wsign-compare)
if ( USE_WERROR )
add_compile_options ( -Werror )
endif ( )
2023-06-20 15:53:06 +02:00
endif ( )
2023-06-20 15:53:07 +02:00
find_program ( PYTHON NAMES python3 python )
execute_process (
C O M M A N D $ { P Y T H O N } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c o n t r i b / c m a k e / p a r s e - v e r s i o n . m 4 . p y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / v e r s i o n . m 4
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
)
include ( ${ CMAKE_CURRENT_BINARY_DIR } /version.cmake )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
set ( OPENVPN_VERSION_MAJOR ${ PRODUCT_VERSION_MAJOR } )
set ( OPENVPN_VERSION_MINOR ${ PRODUCT_VERSION_MINOR } )
set ( OPENVPN_VERSION_PATCH ${ PRODUCT_VERSION_PATCH } )
set ( OPENVPN_VERSION_RESOURCE ${ PRODUCT_VERSION_RESOURCE } )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
set ( CMAKE_C_STANDARD 99 )
2023-06-20 15:53:06 +02:00
# Set the various defines for config.h.cmake.in
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
set ( TARGET_LINUX YES )
set ( ENABLE_ASYNC_PUSH YES )
set ( ENABLE_LINUXDCO YES )
set ( ENABLE_SITNL YES )
set ( HAVE_DECL_SO_MARK YES )
set ( ENABLE_FEATURE_TUN_PERSIST 1 )
set ( HAVE_LINUX_TYPES_H 1 )
set ( ENABLE_DCO YES )
set ( HAVE_CMSGHDR YES )
elseif ( ${ CMAKE_SYSTEM_NAME } STREQUAL "FreeBSD" )
set ( TARGET_FREEBSD YES )
set ( ENABLE_DCO YES )
link_libraries ( -lnv )
2023-11-28 12:14:47 +01:00
elseif ( ${ CMAKE_SYSTEM_NAME } STREQUAL "SunOS" )
set ( TARGET_SOLARIS YES )
set ( HAVE_SYS_SOCKIO_H 1 )
link_libraries ( -lnsl -lsocket -lresolv )
2023-06-20 15:53:06 +02:00
elseif ( WIN32 )
set ( ENABLE_DCO YES )
elseif ( APPLE )
set ( TARGET_DARWIN YES )
set ( HAVE_NET_IF_UTUN_H YES )
2023-11-28 12:14:47 +01:00
else ( )
message ( FATAL_ERROR "Unknown system name: \" ${ CMAKE_SYSTEM_NAME } \"")
2023-06-20 15:53:06 +02:00
endif ( )
if ( UNIX )
set ( PATH_SEPARATOR / )
set ( ENABLE_PORT_SHARE YES )
set ( HAVE_SA_FAMILY_T YES )
elseif ( WIN32 )
set ( PATH_SEPARATOR \\\\)
set ( TARGET_WIN32 YES )
endif ( )
2023-06-20 15:53:07 +02:00
check_symbol_exists ( chroot unistd.h HAVE_CHROOT )
check_symbol_exists ( chdir unistd.h HAVE_CHDIR )
check_symbol_exists ( dup unistd.h HAVE_DUP )
check_symbol_exists ( dup2 unistd.h HAVE_DUP2 )
check_symbol_exists ( fork unistd.h HAVE_FORK )
check_symbol_exists ( execve unistd.h HAVE_EXECVE )
check_symbol_exists ( ftruncate unistd.h HAVE_FTRUNCATE )
2023-11-28 11:41:29 +01:00
check_symbol_exists ( nice unistd.h HAVE_NICE )
2023-06-20 15:53:07 +02:00
check_symbol_exists ( setgid unistd.h HAVE_SETGID )
check_symbol_exists ( setuid unistd.h HAVE_SETUID )
2023-09-20 14:15:19 +02:00
check_symbol_exists ( setsid unistd.h HAVE_SETSID )
2023-06-20 15:53:07 +02:00
check_symbol_exists ( getpeereid unistd.h HAVE_GETPEEREID )
check_symbol_exists ( epoll_create sys/epoll.h HAVE_EPOLL_CREATE )
check_symbol_exists ( gettimeofday sys/time.h HAVE_GETTIMEOFDAY )
check_symbol_exists ( basename libgen.h HAVE_BASENAME )
check_symbol_exists ( chsize io.h HAVE_CHSIZE )
2023-09-22 12:39:00 +02:00
check_symbol_exists ( daemon "unistd.h;stdlib.h" HAVE_DAEMON )
2023-06-20 15:53:07 +02:00
check_symbol_exists ( dirname libgen.h HAVE_DIRNAME )
check_symbol_exists ( getrlimit sys/resource.h HAVE_GETRLIMIT )
check_symbol_exists ( mlockall sys/mman.h HAVE_MLOCKALL )
check_symbol_exists ( sendmsg sys/socket.h HAVE_SENDMSG )
check_symbol_exists ( recvmsg sys/socket.h HAVE_RECVMSG )
check_symbol_exists ( cmsghdr sys/socket.h HAVE_CMSGHDR )
check_symbol_exists ( openlog syslog.h HAVE_OPENLOG )
check_symbol_exists ( syslog syslog.h HAVE_SYSLOG )
check_symbol_exists ( getgrnam grp.h HAVE_GETGRNAM )
check_symbol_exists ( getpwnam pwd.h HAVE_GETPWNAM )
check_symbol_exists ( getsockname sys/socket.h HAVE_GETSOCKNAME )
2023-12-01 13:32:11 +01:00
check_symbol_exists ( getrlimit "sys/time.h;sys/resource.h" HAVE_GETRLIMIT )
2023-06-20 15:53:06 +02:00
# Some OS (e.g. FreeBSD) need some basic headers to allow
# including network headers
2023-06-20 15:53:07 +02:00
set ( NETEXTRA sys/types.h )
check_include_files ( "${NETEXTRA};netinet/in.h" HAVE_NETINET_IN_H )
2023-06-20 15:53:06 +02:00
if ( HAVE_NETINET_IN_H )
2023-06-20 15:53:07 +02:00
list ( APPEND NETEXTRA netinet/in.h )
2023-06-20 15:53:06 +02:00
endif ( )
2023-06-20 15:53:07 +02:00
check_include_files ( "${NETEXTRA};netinet/in6.h" HAVE_NETINET_IN_H )
check_include_files ( linux/if_tun.h HAVE_LINUX_IF_TUN_H )
check_include_files ( linux/sockios.h HAVE_LINUX_SOCKIOS_H )
check_include_files ( dlfcn.h HAVE_DLFCN_H )
check_include_files ( fcntl.h HAVE_FCNTL_H )
check_include_files ( dmalloc.h HAVE_DMALLOC_H )
check_include_files ( err.h HAVE_ERR_H )
check_include_files ( sys/epoll.h HAVE_SYS_EPOLL_H )
check_include_files ( poll.h HAVE_POLL_H )
check_include_files ( sys/socket.h HAVE_SYS_SOCKET_H )
check_include_files ( sys/time.h HAVE_SYS_TIME_H )
check_include_files ( netdb.h HAVE_NETDB_H )
check_include_files ( unistd.h HAVE_UNISTD_H )
check_include_files ( sys/un.h HAVE_SYS_UN_H )
check_include_files ( libgen.h HAVE_LIBGEN_H )
check_include_files ( net/if.h HAVE_NET_IF_H )
check_include_files ( "${NETEXTRA};netinet/ip.h" HAVE_NETINET_IP_H )
check_include_files ( arpa/inet.h HAVE_ARPA_INET_H )
check_include_files ( net/if_utun.h HAVE_NET_UTUN_H )
check_include_files ( sys/ioctl.h HAVE_SYS_IOCTL_H )
check_include_files ( sys/inotify.h HAVE_SYS_INOTIFY_H )
check_include_files ( "${NETEXTRA};sys/uio.h" HAVE_SYS_UIO_H )
check_include_files ( syslog.h HAVE_SYSLOG_H )
check_include_files ( sys/wait.h HAVE_SYS_WAIT_H )
check_include_files ( grp.h HAVE_GRP_H )
check_include_files ( pwd.h HAVE_PWD_H )
check_include_files ( sys/mman.h HAVE_SYS_MMAN_H )
check_include_files ( "${NETEXTRA};resolv.h" HAVE_RESOLV_H )
check_include_files ( "${NETEXTRA};net/if_tun.h" HAVE_NET_IF_TUN_H )
set ( CMAKE_EXTRA_INCLUDE_FILES netinet/ip.h )
check_type_size ( "struct in_pktinfo" IN_PKTINFO )
check_struct_has_member ( "struct in_pktinfo" ipi_spec_dst netinet/ip.h HAVE_IPI_SPEC_DST )
check_type_size ( "struct msghdr" MSGHDR )
set ( CMAKE_EXTRA_INCLUDE_FILES )
2023-06-20 15:53:06 +02:00
find_program ( IFCONFIG_PATH ifconfig )
find_program ( IPROUTE_PATH ip )
find_program ( ROUTE_PATH route )
2023-06-20 15:53:07 +02:00
if ( ${ ENABLE_LZ4 } )
pkg_search_module ( liblz4 liblz4 REQUIRED IMPORTED_TARGET )
endif ( )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
if ( ${ ENABLE_LZO } )
pkg_search_module ( lzo2 lzo2 REQUIRED IMPORTED_TARGET )
endif ( )
if ( ${ ENABLE_PKCS11 } )
pkg_search_module ( pkcs11-helper libpkcs11-helper-1 REQUIRED IMPORTED_TARGET )
2023-06-20 15:53:06 +02:00
endif ( )
2023-12-11 18:05:49 +01:00
function ( check_mbed_configuration )
if ( NOT ( MBED_INCLUDE_PATH STREQUAL "" ) )
set ( CMAKE_REQUIRED_INCLUDES ${ MBED_INCLUDE_PATH } )
endif ( )
if ( NOT ( MBED_LIBRARY_PATH STREQUAL "" ) )
set ( CMAKE_REQUIRED_LINK_OPTIONS "-L${MBED_LIBRARY_PATH}" )
endif ( )
set ( CMAKE_REQUIRED_LIBRARIES "mbedtls;mbedx509;mbedcrypto" )
check_symbol_exists ( mbedtls_ctr_drbg_update_ret mbedtls/ctr_drbg.h HAVE_MBEDTLS_CTR_DRBG_UPDATE_RET )
check_symbol_exists ( mbedtls_ssl_conf_export_keys_ext_cb mbedtls/ssl.h HAVE_MBEDTLS_SSL_CONF_EXPORT_KEYS_EXT_CB )
check_include_files ( psa/crypto.h HAVE_MBEDTLS_PSA_CRYPTO_H )
endfunction ( )
if ( ${ MBED } )
check_mbed_configuration ( )
endif ( )
2023-06-20 15:53:06 +02:00
function ( add_library_deps target )
if ( ${ MBED } )
2023-12-11 18:05:49 +01:00
if ( NOT ( MBED_INCLUDE_PATH STREQUAL "" ) )
target_include_directories ( ${ target } PRIVATE ${ MBED_INCLUDE_PATH } )
endif ( )
if ( NOT ( MBED_LIBRARY_PATH STREQUAL "" ) )
target_link_directories ( ${ target } PRIVATE ${ MBED_LIBRARY_PATH } )
endif ( )
target_link_libraries ( ${ target } PRIVATE -lmbedtls -lmbedx509 -lmbedcrypto )
2023-06-20 15:53:06 +02:00
elseif ( ${ WOLFSSL } )
pkg_search_module ( wolfssl wolfssl REQUIRED )
target_link_libraries ( ${ target } PUBLIC ${ wolfssl_LINK_LIBRARIES } )
target_include_directories ( ${ target } PRIVATE ${ wolfssl_INCLUDE_DIRS } /wolfssl )
else ( )
set ( ENABLE_X509ALTUSERNAME YES )
find_package ( OpenSSL REQUIRED )
2023-06-20 15:53:07 +02:00
target_link_libraries ( ${ target } PUBLIC OpenSSL::SSL OpenSSL::Crypto )
if ( WIN32 )
target_link_libraries ( ${ target } PUBLIC
w s 2 _ 3 2 . l i b c r y p t 3 2 . l i b f w p u c l n t . l i b i p h l p a p i . l i b
w i n i n e t . l i b s e t u p a p i . l i b r p c r t 4 . l i b w t s a p i 3 2 . l i b n c r y p t . l i b b c r y p t . l i b )
endif ( )
2023-06-20 15:53:06 +02:00
endif ( )
2024-01-16 14:18:31 +01:00
if ( MINGW )
target_compile_definitions ( ${ target } PRIVATE
- D W I N 3 2 _ L E A N _ A N D _ M E A N
- D N T D D I _ V E R S I O N = N T D D I _ V I S T A - D _ W I N 3 2 _ W I N N T = _ W I N 3 2 _ W I N N T _ V I S T A
)
endif ( )
2023-06-20 15:53:07 +02:00
# optional dependencies
target_link_libraries ( ${ target } PUBLIC
$ < T A R G E T _ N A M E _ I F _ E X I S T S : P k g C o n f i g : : l i b l z 4 >
$ < T A R G E T _ N A M E _ I F _ E X I S T S : P k g C o n f i g : : l z o 2 >
$ < T A R G E T _ N A M E _ I F _ E X I S T S : P k g C o n f i g : : p k c s 1 1 - h e l p e r >
)
2023-06-20 15:53:06 +02:00
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
2023-06-20 15:53:07 +02:00
pkg_search_module ( libcapng REQUIRED libcap-ng IMPORTED_TARGET )
pkg_search_module ( libnl REQUIRED libnl-genl-3.0 IMPORTED_TARGET )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
target_link_libraries ( ${ target } PUBLIC PkgConfig::libcapng PkgConfig::libnl )
2023-06-20 15:53:06 +02:00
endif ( )
2023-06-20 15:53:07 +02:00
2023-06-20 15:53:06 +02:00
endfunction ( )
if ( ${ MBED } )
set ( ENABLE_CRYPTO_MBEDTLS YES )
elseif ( ${ WOLFSSL } )
set ( ENABLE_CRYPTO_OPENSSL YES )
set ( ENABLE_CRYPTO_WOLFSSL YES )
set ( ENABLE_X509ALTUSERNAME YES )
else ( )
set ( ENABLE_CRYPTO_OPENSSL YES )
set ( ENABLE_X509ALTUSERNAME YES )
endif ( )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } src/compat include )
2023-06-20 15:53:07 +02:00
add_custom_command (
O U T P U T a l w a y s _ r e b u i l d c o n f i g - v e r s i o n . h
C O M M A N D $ { P Y T H O N } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c o n t r i b / c m a k e / g i t - v e r s i o n . p y
)
set ( HAVE_CONFIG_VERSION_H YES )
2023-06-20 15:53:06 +02:00
configure_file ( config.h.cmake.in config.h )
configure_file ( include/openvpn-plugin.h.in openvpn-plugin.h )
2023-09-19 17:56:35 +02:00
# TODO we should remove the need for this, and always include config.h
2023-06-20 15:53:07 +02:00
add_definitions ( -DHAVE_CONFIG_H )
2023-06-20 15:53:06 +02:00
include_directories ( ${ CMAKE_CURRENT_BINARY_DIR } )
2023-06-20 15:53:07 +02:00
add_subdirectory ( doc )
add_subdirectory ( src/openvpnmsica )
add_subdirectory ( src/openvpnserv )
add_subdirectory ( src/tapctl )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
set ( SOURCE_FILES
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c o n f i g . h
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c o n f i g - v e r s i o n . h
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / o p e n v p n - p l u g i n . h
s r c / c o m p a t / c o m p a t - b a s e n a m e . c
s r c / c o m p a t / c o m p a t - d a e m o n . c
s r c / c o m p a t / c o m p a t - d i r n a m e . c
s r c / c o m p a t / c o m p a t - g e t t i m e o f d a y . c
s r c / c o m p a t / c o m p a t - s t r s e p . c
s r c / o p e n v p n / a r g v . c
s r c / o p e n v p n / a r g v . h
s r c / o p e n v p n / b a s e 6 4 . c
s r c / o p e n v p n / b a s e 6 4 . h
s r c / o p e n v p n / b a s i c . h
s r c / o p e n v p n / b l o c k _ d n s . h
s r c / o p e n v p n / b l o c k _ d n s . c
s r c / o p e n v p n / b u f f e r . c
s r c / o p e n v p n / b u f f e r . h
s r c / o p e n v p n / c i r c _ l i s t . h
s r c / o p e n v p n / c l i n a t . c
s r c / o p e n v p n / c l i n a t . h
s r c / o p e n v p n / c o m m o n . h
s r c / o p e n v p n / c o m p - l z 4 . c
s r c / o p e n v p n / c o m p - l z 4 . h
s r c / o p e n v p n / c o m p . c
s r c / o p e n v p n / c o m p . h
s r c / o p e n v p n / c o m p s t u b . c
s r c / o p e n v p n / c o n s o l e . c
s r c / o p e n v p n / c o n s o l e _ b u i l t i n . c
s r c / o p e n v p n / c o n s o l e . h
s r c / o p e n v p n / c r y p t o . c
s r c / o p e n v p n / c r y p t o . h
s r c / o p e n v p n / c r y p t o _ b a c k e n d . h
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . h
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ m b e d t l s . h
s r c / o p e n v p n / c r y p t o a p i . c
s r c / o p e n v p n / c r y p t o a p i . h
s r c / o p e n v p n / d c o . c
s r c / o p e n v p n / d c o . h
s r c / o p e n v p n / d c o _ w i n . c
s r c / o p e n v p n / d c o _ w i n . h
s r c / o p e n v p n / d c o _ l i n u x . c
s r c / o p e n v p n / d c o _ l i n u x . h
s r c / o p e n v p n / d c o _ f r e e b s d . c
s r c / o p e n v p n / d c o _ f r e e b s d . h
s r c / o p e n v p n / d h c p . c
s r c / o p e n v p n / d h c p . h
s r c / o p e n v p n / d n s . c
s r c / o p e n v p n / d n s . h
s r c / o p e n v p n / e r r l e v e l . h
s r c / o p e n v p n / e n v _ s e t . c
s r c / o p e n v p n / e n v _ s e t . h
s r c / o p e n v p n / e r r o r . c
s r c / o p e n v p n / e r r o r . h
s r c / o p e n v p n / e v e n t . c
s r c / o p e n v p n / e v e n t . h
s r c / o p e n v p n / f d m i s c . c
s r c / o p e n v p n / f d m i s c . h
s r c / o p e n v p n / f o r w a r d . c
s r c / o p e n v p n / f o r w a r d . h
s r c / o p e n v p n / f r a g m e n t . c
s r c / o p e n v p n / f r a g m e n t . h
s r c / o p e n v p n / g r e m l i n . c
s r c / o p e n v p n / g r e m l i n . h
s r c / o p e n v p n / h e l p e r . c
s r c / o p e n v p n / h e l p e r . h
s r c / o p e n v p n / h t t p d i g e s t . c
s r c / o p e n v p n / h t t p d i g e s t . h
s r c / o p e n v p n / i n i t . c
s r c / o p e n v p n / i n i t . h
s r c / o p e n v p n / i n t e g e r . h
s r c / o p e n v p n / i n t e r v a l . c
s r c / o p e n v p n / i n t e r v a l . h
s r c / o p e n v p n / l i s t . c
s r c / o p e n v p n / l i s t . h
s r c / o p e n v p n / l l a d d r . c
s r c / o p e n v p n / l l a d d r . h
s r c / o p e n v p n / l z o . c
s r c / o p e n v p n / l z o . h
s r c / o p e n v p n / m a n a g e . c
s r c / o p e n v p n / m a n a g e . h
s r c / o p e n v p n / m b u f . c
s r c / o p e n v p n / m b u f . h
s r c / o p e n v p n / m e m d b g . h
s r c / o p e n v p n / m i s c . c
s r c / o p e n v p n / m i s c . h
s r c / o p e n v p n / m r o u t e . c
s r c / o p e n v p n / m r o u t e . h
s r c / o p e n v p n / m s s . c
s r c / o p e n v p n / m s s . h
s r c / o p e n v p n / m s t a t s . c
s r c / o p e n v p n / m s t a t s . h
s r c / o p e n v p n / m t c p . c
s r c / o p e n v p n / m t c p . h
s r c / o p e n v p n / m t u . c
s r c / o p e n v p n / m t u . h
s r c / o p e n v p n / m u d p . c
s r c / o p e n v p n / m u d p . h
s r c / o p e n v p n / m u l t i . c
s r c / o p e n v p n / m u l t i . h
s r c / o p e n v p n / n t l m . c
s r c / o p e n v p n / n t l m . h
s r c / o p e n v p n / o c c . c
s r c / o p e n v p n / o c c . h
s r c / o p e n v p n / o p e n v p n . c
s r c / o p e n v p n / o p e n v p n . h
s r c / o p e n v p n / o p e n v p n _ w i n 3 2 _ r e s o u r c e s . r c
s r c / o p e n v p n / o p t i o n s . c
s r c / o p e n v p n / o p t i o n s . h
s r c / o p e n v p n / o p t i o n s _ u t i l . c
s r c / o p e n v p n / o p t i o n s _ u t i l . h
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / o t i m e . h
s r c / o p e n v p n / o v p n _ d c o _ w i n . h
s r c / o p e n v p n / p a c k e t _ i d . c
s r c / o p e n v p n / p a c k e t _ i d . h
s r c / o p e n v p n / p e r f . c
s r c / o p e n v p n / p e r f . h
s r c / o p e n v p n / p i n g . c
s r c / o p e n v p n / p i n g . h
s r c / o p e n v p n / p k c s 1 1 . c
s r c / o p e n v p n / p k c s 1 1 . h
s r c / o p e n v p n / p k c s 1 1 _ b a c k e n d . h
s r c / o p e n v p n / p k c s 1 1 _ o p e n s s l . c
s r c / o p e n v p n / p k c s 1 1 _ m b e d t l s . c
s r c / o p e n v p n / p l a t f o r m . c
s r c / o p e n v p n / p l a t f o r m . h
s r c / o p e n v p n / p l u g i n . c
s r c / o p e n v p n / p l u g i n . h
s r c / o p e n v p n / p o o l . c
s r c / o p e n v p n / p o o l . h
s r c / o p e n v p n / p r o t o . c
s r c / o p e n v p n / p r o t o . h
s r c / o p e n v p n / p r o x y . c
s r c / o p e n v p n / p r o x y . h
s r c / o p e n v p n / p s . c
s r c / o p e n v p n / p s . h
s r c / o p e n v p n / p u s h . c
s r c / o p e n v p n / p u s h . h
s r c / o p e n v p n / p u s h l i s t . h
s r c / o p e n v p n / r e f l e c t _ f i l t e r . c
s r c / o p e n v p n / r e f l e c t _ f i l t e r . h
s r c / o p e n v p n / r e l i a b l e . c
s r c / o p e n v p n / r e l i a b l e . h
s r c / o p e n v p n / r o u t e . c
s r c / o p e n v p n / r o u t e . h
s r c / o p e n v p n / r u n _ c o m m a n d . c
s r c / o p e n v p n / r u n _ c o m m a n d . h
s r c / o p e n v p n / s c h e d u l e . c
s r c / o p e n v p n / s c h e d u l e . h
s r c / o p e n v p n / s e s s i o n _ i d . c
s r c / o p e n v p n / s e s s i o n _ i d . h
s r c / o p e n v p n / s h a p e r . c
s r c / o p e n v p n / s h a p e r . h
s r c / o p e n v p n / s i g . c
s r c / o p e n v p n / s i g . h
s r c / o p e n v p n / s o c k e t . c
s r c / o p e n v p n / s o c k e t . h
s r c / o p e n v p n / s o c k s . c
s r c / o p e n v p n / s o c k s . h
s r c / o p e n v p n / s s l . c
s r c / o p e n v p n / s s l . h
s r c / o p e n v p n / s s l _ b a c k e n d . h
s r c / o p e n v p n / s s l _ c o m m o n . h
s r c / o p e n v p n / s s l _ o p e n s s l . c
s r c / o p e n v p n / s s l _ o p e n s s l . h
s r c / o p e n v p n / s s l _ m b e d t l s . c
s r c / o p e n v p n / s s l _ m b e d t l s . h
s r c / o p e n v p n / s s l _ v e r i f y . c
s r c / o p e n v p n / s s l _ v e r i f y . h
s r c / o p e n v p n / s s l _ v e r i f y _ b a c k e n d . h
s r c / o p e n v p n / s s l _ v e r i f y _ o p e n s s l . c
s r c / o p e n v p n / s s l _ v e r i f y _ o p e n s s l . h
s r c / o p e n v p n / s s l _ v e r i f y _ m b e d t l s . c
s r c / o p e n v p n / s s l _ v e r i f y _ m b e d t l s . h
s r c / o p e n v p n / s t a t u s . c
s r c / o p e n v p n / s t a t u s . h
s r c / o p e n v p n / s y s h e a d . h
s r c / o p e n v p n / t l s _ c r y p t . c
s r c / o p e n v p n / t u n . c
s r c / o p e n v p n / t u n . h
s r c / o p e n v p n / n e t w o r k i n g _ s i t n l . c
s r c / o p e n v p n / n e t w o r k i n g _ f r e e b s d . c
s r c / o p e n v p n / a u t h _ t o k e n . c
s r c / o p e n v p n / a u t h _ t o k e n . h
s r c / o p e n v p n / s s l _ n c p . c
s r c / o p e n v p n / s s l _ n c p . h
s r c / o p e n v p n / s s l _ p k t . c
s r c / o p e n v p n / s s l _ p k t . h
s r c / o p e n v p n / s s l _ u t i l . c
s r c / o p e n v p n / s s l _ u t i l . h
s r c / o p e n v p n / v l a n . c
s r c / o p e n v p n / v l a n . h
s r c / o p e n v p n / w i n 3 2 . c
s r c / o p e n v p n / w i n 3 2 - u t i l . c
s r c / o p e n v p n / w i n 3 2 . h
s r c / o p e n v p n / w i n 3 2 - u t i l . h
s r c / o p e n v p n / x k e y _ h e l p e r . c
s r c / o p e n v p n / x k e y _ p r o v i d e r . c
)
2023-06-20 15:53:06 +02:00
add_executable ( openvpn ${ SOURCE_FILES } )
add_library_deps ( openvpn )
2024-01-16 14:18:31 +01:00
if ( MINGW )
2023-06-20 15:53:07 +02:00
target_compile_options ( openvpn PRIVATE -municode -UUNICODE )
2023-06-20 15:53:06 +02:00
target_link_options ( openvpn PRIVATE -municode )
2023-06-20 15:53:07 +02:00
endif ( )
if ( MSVC )
# we have our own manifest
target_link_options ( openvpn PRIVATE /MANIFEST:NO )
endif ( )
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
target_link_libraries ( openvpn PUBLIC -ldl )
2023-06-20 15:53:06 +02:00
endif ( )
if ( NOT WIN32 )
2023-06-20 15:53:07 +02:00
target_compile_options ( openvpn PRIVATE -DPLUGIN_LIBDIR=\ "${PLUGIN_DIR}\" )
2023-06-20 15:53:06 +02:00
find_library ( resolv resolv )
# some platform like BSDs already include resolver functionality in the libc and not have an extra resolv library
if ( ${ resolv } OR APPLE )
target_link_libraries ( openvpn PUBLIC -lresolv )
endif ( )
endif ( )
2023-06-20 15:53:07 +02:00
if ( BUILD_TESTING )
find_package ( cmocka CONFIG )
if ( TARGET cmocka::cmocka )
set ( CMOCKA_LIBRARIES cmocka::cmocka )
else ( )
pkg_search_module ( cmocka cmocka REQUIRED IMPORTED_TARGET )
set ( CMOCKA_LIBRARIES PkgConfig::cmocka )
endif ( )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
set ( unit_tests
" t e s t _ a u t h _ t o k e n "
" t e s t _ b u f f e r "
" t e s t _ c r y p t o "
" t e s t _ m i s c "
" t e s t _ n c p "
" t e s t _ p a c k e t _ i d "
" t e s t _ p k t "
" t e s t _ p r o v i d e r "
2024-01-16 22:41:52 +01:00
" t e s t _ s s l "
2024-01-27 21:07:16 +01:00
" t e s t _ u s e r _ p a s s "
2023-06-20 15:53:07 +02:00
)
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
if ( WIN32 )
list ( APPEND unit_tests
" t e s t _ c r y p t o a p i "
)
endif ( )
2023-07-12 11:55:29 +02:00
# MSVC and Apple's LLVM ld do not support --wrap
# This test requires cmake >= 3.18, so check if check_linker_flag is
# available
if ( COMMAND check_linker_flag )
check_linker_flag ( C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP )
endif ( )
if ( ${ LD_SUPPORTS_WRAP } )
2023-06-20 15:53:07 +02:00
list ( APPEND unit_tests
" t e s t _ a r g v "
2023-07-12 11:55:29 +02:00
" t e s t _ t l s _ c r y p t "
2023-06-20 15:53:07 +02:00
)
endif ( )
2023-07-12 11:55:29 +02:00
# These tests work on only on Linux since they depend on special Linux features
2023-06-20 15:53:07 +02:00
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
list ( APPEND unit_tests
" t e s t _ n e t w o r k i n g "
)
endif ( )
if ( NOT WIN32 AND ${ ENABLE_PKCS11 } )
set ( _HAVE_SOFTHSM2 YES )
find_program ( P11TOOL p11tool )
find_program ( SOFTHSM2_UTIL softhsm2-util )
find_library ( SOFTHSM2_MODULE softhsm2 PATH_SUFFIXES softhsm )
if ( P11TOOL STREQUAL "P11TOOL-NOTFOUND" )
message ( STATUS "p11tool not found, pkcs11 UT disabled" )
set ( _HAVE_SOFTHSM2 NO )
elseif ( SOFTHSM2_UTIL STREQUAL "SOFTHSM2_UTIL-NOTFOUND" )
message ( STATUS "softhsm2-util not found, pkcs11 UT disabled" )
set ( _HAVE_SOFTHSM2 NO )
elseif ( SOFTHSM2_MODULE STREQUAL "SOFTHSM2_MODULE-NOTFOUND" )
message ( STATUS "softhsm2 module not found, pkcs11 UT disabled" )
set ( _HAVE_SOFTHSM2 NO )
endif ( )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
if ( _HAVE_SOFTHSM2 )
message ( VERBOSE "pkcs11 UT enabled" )
list ( APPEND unit_tests
" t e s t _ p k c s 1 1 "
)
endif ( )
endif ( )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
foreach ( test_name ${ unit_tests } )
# test_networking needs special environment
if ( NOT ${ test_name } STREQUAL "test_networking" )
add_test ( ${ test_name } ${ test_name } )
2024-01-27 21:07:16 +01:00
# for compat with autotools make check
set ( _UT_SOURCE_DIR ${ CMAKE_CURRENT_SOURCE_DIR } /tests/unit_tests/openvpn )
set_tests_properties ( ${ test_name } PROPERTIES
E N V I R O N M E N T " s r c d i r = $ { _ U T _ S O U R C E _ D I R } " )
2023-06-20 15:53:07 +02:00
endif ( )
add_executable ( ${ test_name }
2023-06-20 15:53:06 +02:00
t e s t s / u n i t _ t e s t s / o p e n v p n / $ { t e s t _ n a m e } . c
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ m s g . c
2023-06-20 15:53:07 +02:00
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ m s g . h
2023-06-20 15:53:06 +02:00
s r c / o p e n v p n / p l a t f o r m . c
s r c / o p e n v p n / w i n 3 2 - u t i l . c
s r c / c o m p a t / c o m p a t - g e t t i m e o f d a y . c
)
2023-06-20 15:53:07 +02:00
add_library_deps ( ${ test_name } )
target_link_libraries ( ${ test_name } PUBLIC ${ CMOCKA_LIBRARIES } )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
target_include_directories ( ${ test_name } PRIVATE src/openvpn )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
if ( NOT ${ test_name } STREQUAL "test_buffer" )
target_sources ( ${ test_name } PRIVATE
2023-06-20 15:53:06 +02:00
s r c / o p e n v p n / b u f f e r . c
)
2023-06-20 15:53:07 +02:00
endif ( )
endforeach ( )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
target_sources ( test_auth_token PRIVATE
s r c / o p e n v p n / b a s e 6 4 . c
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
)
target_sources ( test_buffer PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
)
target_sources ( test_crypto PRIVATE
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
s r c / o p e n v p n / m t u . c
s r c / o p e n v p n / m s s . c
)
2024-01-16 22:41:52 +01:00
target_sources ( test_ssl PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ m a n a g e m e n t . c
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ s s l _ d e p e n d e n c i e s . c
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ w i n 3 2 _ e x e c v e . c
s r c / o p e n v p n / a r g v . c
s r c / o p e n v p n / b a s e 6 4 . c
s r c / o p e n v p n / c r y p t o . c
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o a p i . c
s r c / o p e n v p n / e n v _ s e t . c
s r c / o p e n v p n / m s s . c
s r c / o p e n v p n / m t u . c
s r c / o p e n v p n / o p t i o n s _ u t i l . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
s r c / o p e n v p n / r u n _ c o m m a n d . c
s r c / o p e n v p n / s s l _ m b e d t l s . c
s r c / o p e n v p n / s s l _ o p e n s s l . c
s r c / o p e n v p n / s s l _ u t i l . c
s r c / o p e n v p n / s s l _ v e r i f y _ m b e d t l s . c
s r c / o p e n v p n / s s l _ v e r i f y _ o p e n s s l . c
s r c / o p e n v p n / x k e y _ h e l p e r . c
s r c / o p e n v p n / x k e y _ p r o v i d e r . c
)
2023-06-20 15:53:07 +02:00
target_sources ( test_misc PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
s r c / o p e n v p n / o p t i o n s _ u t i l . c
s r c / o p e n v p n / s s l _ u t i l . c
)
target_sources ( test_ncp PRIVATE
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
s r c / o p e n v p n / s s l _ u t i l . c
s r c / c o m p a t / c o m p a t - s t r s e p . c
)
target_sources ( test_packet_id PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
s r c / o p e n v p n / r e l i a b l e . c
s r c / o p e n v p n / s e s s i o n _ i d . c
)
target_sources ( test_pkt PRIVATE
2023-07-12 11:54:12 +02:00
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ w i n 3 2 _ e x e c v e . c
2023-06-20 15:53:06 +02:00
s r c / o p e n v p n / a r g v . c
2023-06-20 15:53:07 +02:00
s r c / o p e n v p n / b a s e 6 4 . c
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o . c
2023-06-20 15:53:06 +02:00
s r c / o p e n v p n / e n v _ s e t . c
2023-06-20 15:53:07 +02:00
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
2023-06-20 15:53:06 +02:00
s r c / o p e n v p n / r e l i a b l e . c
s r c / o p e n v p n / r u n _ c o m m a n d . c
s r c / o p e n v p n / s e s s i o n _ i d . c
s r c / o p e n v p n / s s l _ p k t . c
s r c / o p e n v p n / t l s _ c r y p t . c
)
2023-06-20 15:53:07 +02:00
target_sources ( test_provider PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
2023-06-20 15:53:06 +02:00
s r c / o p e n v p n / x k e y _ p r o v i d e r . c
s r c / o p e n v p n / x k e y _ h e l p e r . c
2023-06-20 15:53:07 +02:00
s r c / o p e n v p n / b a s e 6 4 . c
2023-06-20 15:53:06 +02:00
)
2024-01-27 21:07:16 +01:00
target_sources ( test_user_pass PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ w i n 3 2 _ e x e c v e . c
s r c / o p e n v p n / b a s e 6 4 . c
s r c / o p e n v p n / c o n s o l e . c
s r c / o p e n v p n / e n v _ s e t . c
s r c / o p e n v p n / r u n _ c o m m a n d . c
)
2023-06-20 15:53:07 +02:00
if ( TARGET test_argv )
target_link_options ( test_argv PRIVATE -Wl,--wrap=parse_line )
target_sources ( test_argv PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
2023-06-20 15:53:06 +02:00
s r c / o p e n v p n / a r g v . c
2023-06-20 15:53:07 +02:00
)
endif ( )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
if ( TARGET test_cryptoapi )
target_sources ( test_cryptoapi PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
t e s t s / u n i t _ t e s t s / o p e n v p n / c e r t _ d a t a . h
t e s t s / u n i t _ t e s t s / o p e n v p n / p k e y _ t e s t _ u t i l s . c
s r c / o p e n v p n / x k e y _ p r o v i d e r . c
s r c / o p e n v p n / x k e y _ h e l p e r . c
s r c / o p e n v p n / b a s e 6 4 . c
)
endif ( )
2023-06-20 15:53:06 +02:00
2023-06-20 15:53:07 +02:00
if ( TARGET test_networking )
target_link_options ( test_networking PRIVATE -Wl,--wrap=parse_line )
target_compile_options ( test_networking PRIVATE -UNDEBUG )
target_sources ( test_networking PRIVATE
s r c / o p e n v p n / n e t w o r k i n g _ s i t n l . c
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
)
2023-06-20 15:53:06 +02:00
endif ( )
2023-06-20 15:53:07 +02:00
if ( TARGET test_tls_crypt )
target_link_options ( test_tls_crypt PRIVATE -Wl,--wrap=parse_line )
target_link_options ( test_tls_crypt PRIVATE
2023-06-20 15:53:06 +02:00
- W l , - - w r a p = b u f f e r _ r e a d _ f r o m _ f i l e
- W l , - - w r a p = b u f f e r _ w r i t e _ f i l e
- W l , - - w r a p = r a n d _ b y t e s )
2023-06-20 15:53:07 +02:00
target_sources ( test_tls_crypt PRIVATE
2023-07-12 11:54:12 +02:00
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ w i n 3 2 _ e x e c v e . c
2023-06-20 15:53:07 +02:00
s r c / o p e n v p n / a r g v . c
s r c / o p e n v p n / b a s e 6 4 . c
s r c / o p e n v p n / c r y p t o _ m b e d t l s . c
s r c / o p e n v p n / c r y p t o _ o p e n s s l . c
s r c / o p e n v p n / c r y p t o . c
s r c / o p e n v p n / e n v _ s e t . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p a c k e t _ i d . c
s r c / o p e n v p n / r u n _ c o m m a n d . c
)
endif ( )
if ( TARGET test_pkcs11 )
target_compile_options ( test_pkcs11 PRIVATE
- D P 1 1 T O O L _ P A T H = \ " $ { P 1 1 T O O L } \ "
- D S O F T H S M 2 _ M O D U L E _ P A T H = \ " $ { S O F T H S M 2 _ M O D U L E } \ "
- D S O F T H S M 2 _ U T I L _ P A T H = \ " $ { S O F T H S M 2 _ U T I L } \ "
)
target_sources ( test_pkcs11 PRIVATE
t e s t s / u n i t _ t e s t s / o p e n v p n / m o c k _ g e t _ r a n d o m . c
t e s t s / u n i t _ t e s t s / o p e n v p n / p k e y _ t e s t _ u t i l s . c
s r c / o p e n v p n / a r g v . c
s r c / o p e n v p n / b a s e 6 4 . c
s r c / o p e n v p n / e n v _ s e t . c
s r c / o p e n v p n / o t i m e . c
s r c / o p e n v p n / p k c s 1 1 . c
s r c / o p e n v p n / p k c s 1 1 _ o p e n s s l . c
s r c / o p e n v p n / r u n _ c o m m a n d . c
s r c / o p e n v p n / x k e y _ h e l p e r . c
s r c / o p e n v p n / x k e y _ p r o v i d e r . c
)
endif ( )
endif ( BUILD_TESTING )