2021-03-01 04:37:00 +03:00
cmake_minimum_required ( VERSION 3.10 )
2018-05-22 23:20:41 +03:00
2021-02-19 23:05:43 +03:00
set ( BUILD_NUMBER CACHE STRING "The number of the current build." )
if ( "${BUILD_NUMBER}" STREQUAL "" )
2021-06-24 11:12:21 +03:00
set ( BUILD_NUMBER "5180" )
2021-02-19 23:05:43 +03:00
endif ( )
2021-06-24 10:45:32 +03:00
if ( BUILD_NUMBER LESS 5180 )
message ( WARNING
2021-06-24 11:04:28 +03:00
" S e t t i n g B U I L D _ N U M B E R t o a v a l u e l e s s t h a n 5 1 8 0 w i l l b r e a k c o m p a t i b i l i t y w i t h c l i e n t b i n a r i e s d i s t r i b u t e d b y S o f t E t h e r C o r p o r a t i o n . "
2021-06-24 10:58:12 +03:00
" S e t t o a v a l u e g r e a t e r t h a n o r e q u a l t o 5 1 8 0 i f y o u w a n t s u c h c l i e n t s t o w o r k p r o p e r l y . \ n "
2021-06-24 11:04:28 +03:00
" F o r d e t a i l e d i n f o : h t t p s : / / g i t h u b . c o m / S o f t E t h e r V P N / S o f t E t h e r V P N / i s s u e s / 1 3 9 2 #issuecomment-867348281")
2021-06-24 10:45:32 +03:00
endif ( )
2018-11-19 02:13:59 +03:00
project ( "SoftEther VPN"
2021-05-25 02:29:36 +03:00
V E R S I O N " 5 . 0 2 . $ { B U I L D _ N U M B E R } "
2018-08-10 00:33:38 +03:00
L A N G U A G E S C
)
2018-05-22 23:20:41 +03:00
2021-02-27 02:35:58 +03:00
set ( CMAKE_C_STANDARD 99 )
2018-11-19 02:13:59 +03:00
set ( TOP_DIRECTORY ${ CMAKE_SOURCE_DIR } )
2020-07-20 19:31:41 +03:00
set ( BUILD_DIRECTORY ${ CMAKE_BINARY_DIR } )
2018-11-19 02:13:59 +03:00
2018-11-18 06:18:42 +03:00
# We define a dedicated variable because CMAKE_BUILD_TYPE can have different
# configurations than "Debug" and "Release", such as "RelWithDebInfo".
if ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set ( BUILD_TYPE "Debug" )
else ( )
set ( BUILD_TYPE "Release" )
endif ( )
2018-05-22 23:20:41 +03:00
2018-08-07 18:38:06 +03:00
# Check that submodules are present only if source was downloaded with git
2021-03-10 04:13:00 +03:00
if ( EXISTS "${TOP_DIRECTORY}/.git" AND NOT EXISTS "${TOP_DIRECTORY}/src/libhamcore/CMakeLists.txt" )
2018-08-07 18:38:06 +03:00
message ( FATAL_ERROR "Submodules are not initialized. Run\n\tgit submodule update --init --recursive" )
endif ( )
2018-10-24 20:23:07 +03:00
if ( UNIX )
include ( GNUInstallDirs )
2018-10-23 22:32:41 +03:00
2018-10-24 20:23:07 +03:00
include ( CheckIncludeFile )
Check_Include_File ( sys/auxv.h HAVE_SYS_AUXV )
2019-10-29 18:33:28 +03:00
if ( EXISTS "/lib/systemd/system" )
set ( CMAKE_INSTALL_SYSTEMD_UNITDIR "/lib/systemd/system" CACHE STRING "Where to install systemd unit files" )
endif ( )
2018-10-24 20:23:07 +03:00
endif ( )
2018-10-11 23:03:12 +03:00
2018-11-19 02:13:59 +03:00
configure_file ( "${TOP_DIRECTORY}/AUTHORS.TXT" "${TOP_DIRECTORY}/src/bin/hamcore/authors.txt" COPYONLY )
2018-10-03 08:24:42 +03:00
2018-11-27 07:26:21 +03:00
# Date and time
string ( TIMESTAMP DATE_DAY "%d" UTC )
string ( TIMESTAMP DATE_MONTH "%m" UTC )
string ( TIMESTAMP DATE_YEAR "%Y" UTC )
string ( TIMESTAMP TIME_HOUR "%H" UTC )
string ( TIMESTAMP TIME_MINUTE "%M" UTC )
string ( TIMESTAMP TIME_SECOND "%S" UTC )
message ( STATUS "Build date: ${DATE_DAY}/${DATE_MONTH}/${DATE_YEAR}" )
message ( STATUS "Build time: ${TIME_HOUR}:${TIME_MINUTE}:${TIME_SECOND}" )
2018-05-22 23:20:41 +03:00
add_subdirectory ( src )
2018-08-10 00:33:38 +03:00
2018-10-24 20:23:07 +03:00
if ( UNIX )
# Packaging
set ( CPACK_COMPONENTS_ALL common vpnserver vpnclient vpnbridge vpncmd )
set ( CPACK_PACKAGE_DIRECTORY ${ BUILD_DIRECTORY } )
set ( CPACK_PACKAGE_VERSION ${ PROJECT_VERSION } )
set ( CPACK_PACKAGE_VENDOR "SoftEther" )
set ( CPACK_PACKAGE_NAME "softether" )
2018-11-19 02:13:59 +03:00
set ( CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_DIRECTORY}/description" )
2018-10-24 20:23:07 +03:00
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "SoftEther VPN is an open-source cross-platform multi-protocol VPN program, created as an academic project in the University of Tsukuba." )
# DEB
2018-11-19 02:13:59 +03:00
if ( BUILD_TYPE STREQUAL "Debug" )
2018-10-24 20:23:07 +03:00
set ( CPACK_DEBIAN_PACKAGE_DEBUG ON )
endif ( )
set ( CPACK_DEB_COMPONENT_INSTALL ON )
set ( CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
set ( CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT" )
set ( CPACK_DEBIAN_PACKAGE_SECTION "net" )
set ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Unknown" )
# RPM
set ( CPACK_RPM_COMPONENT_INSTALL ON )
set ( CPACK_RPM_FILE_NAME "RPM-DEFAULT" )
set ( CPACK_RPM_PACKAGE_GROUP "Applications/Internet" )
2019-01-14 06:42:15 +03:00
set ( CPACK_RPM_PACKAGE_LICENSE "ASL 2.0" )
2018-10-24 20:23:07 +03:00
2020-06-30 06:11:05 +03:00
# Exclude system directories
if ( CPACK_GENERATOR STREQUAL "RPM" )
execute_process (
C O M M A N D r p m - q l f i l e s y s t e m
C O M M A N D t r \ n \ ;
O U T P U T _ V A R I A B L E C P A C K _ R P M _ E X C L U D E _ F R O M _ A U T O _ F I L E L I S T _ A D D I T I O N
E R R O R _ Q U I E T )
endif ( )
2018-10-24 20:23:07 +03:00
include ( CPack )
2018-10-23 22:32:41 +03:00
endif ( )