2018-08-13 06:48:45 +03:00
cmake_minimum_required ( VERSION 3.7 )
2018-05-22 23:20:41 +03:00
2018-08-10 00:33:38 +03:00
project ( SoftEtherVPN
2018-10-22 19:57:21 +03:00
V E R S I O N 5 . 0 1 . 9 6 6 1
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
set ( default_build_type "Release" )
2018-08-07 18:38:06 +03:00
# Check that submodules are present only if source was downloaded with git
2018-10-24 20:23:07 +03:00
if ( EXISTS "${SoftEtherVPN_SOURCE_DIR}/.git" AND NOT EXISTS "${SoftEtherVPN_SOURCE_DIR}/src/Mayaqua/3rdparty/cpu_features/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-09-28 21:38:31 +03:00
# Compare ${PROJECT_VERSION} and src/CurrentBuild.txt
file ( READ ${ SoftEtherVPN_SOURCE_DIR } /src/CurrentBuild.txt CurrentBuild )
string ( REGEX MATCH "VERSION_MAJOR ([0-9]+)" temp ${ CurrentBuild } )
string ( REGEX REPLACE "VERSION_MAJOR ([0-9]+)" "\\1" CurrentBuild_MAJOR ${ temp } )
string ( REGEX MATCH "VERSION_MINOR ([0-9]+)" temp ${ CurrentBuild } )
string ( REGEX REPLACE "VERSION_MINOR ([0-9]+)" "\\1" CurrentBuild_MINOR ${ temp } )
string ( REGEX MATCH "VERSION_BUILD ([0-9]+)" temp ${ CurrentBuild } )
string ( REGEX REPLACE "VERSION_BUILD ([0-9]+)" "\\1" CurrentBuild_BUILD ${ temp } )
2018-10-24 20:23:07 +03:00
if ( NOT ${ PROJECT_VERSION } VERSION_EQUAL "${CurrentBuild_MAJOR}.${CurrentBuild_MINOR}.${CurrentBuild_BUILD}" )
2018-09-28 21:38:31 +03:00
message ( FATAL_ERROR "PROJECT_VERSION does not match to src/CurrentBuild.txt" )
endif ( )
2018-10-24 20:23:07 +03:00
if ( UNIX )
include ( GNUInstallDirs )
set ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" )
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 )
endif ( )
2018-10-11 23:03:12 +03:00
2018-10-03 08:24:42 +03:00
configure_file ( "${SoftEtherVPN_SOURCE_DIR}/AUTHORS.TXT" "${SoftEtherVPN_SOURCE_DIR}/src/bin/hamcore/authors.txt" COPYONLY )
2018-08-12 20:22:51 +03:00
set ( BUILD_DIRECTORY ${ SoftEtherVPN_SOURCE_DIR } /build )
2018-10-22 08:55:12 +03:00
set ( CPACK_PACKAGING_INSTALL_PREFIX ${ CMAKE_INSTALL_PREFIX } )
2018-08-12 20:22:51 +03:00
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" )
set ( CPACK_PACKAGE_DESCRIPTION_FILE "${SoftEtherVPN_SOURCE_DIR}/description" )
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
if ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
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" )
set ( CPACK_RPM_PACKAGE_LICENSE "GPLv2" )
include ( CPack )
2018-10-23 22:32:41 +03:00
endif ( )