2020-05-21 18:11:45 +04:00
cmake_minimum_required ( VERSION 3.0 )
2021-02-11 16:51:06 +04:00
# You can get version from spec by first finding Versions keyword.
# After that you can use awk to split line by : and then select second part of it.
# Finally you want to clear all the spaces around version.
# OUTPUT_VARIABLE argument of execute_process allows you to capture output of the command.
execute_process (
C O M M A N D
b a s h - c " g r e p V e r s i o n : . g e a r / a d m c . s p e c | a w k - F \ " : \ " ' { p r i n t $ 2 } ' | t r - d [ : s p a c e : ] "
O U T P U T _ V A R I A B L E G E A R _ V E R S I O N
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ S O U R C E _ D I R } )
# To ensure that we have indeed captured the project version we use message to provide us with console output.
message ( STATUS "Project version is: " ${ GEAR_VERSION } )
project ( admc VERSION ${ GEAR_VERSION } )
2020-05-21 18:11:45 +04:00
set ( CMAKE_MODULE_PATH
2020-05-27 14:26:08 +04:00
$ { C M A K E _ M O D U L E _ P A T H }
2020-09-04 15:51:39 +04:00
$ { P R O J E C T _ S O U R C E _ D I R } / c m a k e
2020-05-21 18:11:45 +04:00
)
2020-09-07 13:51:25 +04:00
set ( EXECUTABLE_OUTPUT_PATH ${ CMAKE_BINARY_DIR } )
2020-09-04 14:57:14 +04:00
set ( LIBRARY_OUTPUT_PATH ${ EXECUTABLE_OUTPUT_PATH } )
2021-02-08 16:36:04 +04:00
enable_testing ( )
2021-06-01 16:26:24 +04:00
include ( GNUInstallDirs )
2021-06-02 17:21:28 +04:00
option ( ADMC_BUILD_DEB "Build the deb package of ADMC." OFF )
2020-10-06 16:29:00 +04:00
add_subdirectory ( src )
2021-06-02 17:21:28 +04:00
if ( NOT ADMC_BUILD_DEB )
add_subdirectory ( tests )
endif ( NOT ADMC_BUILD_DEB )
2021-03-04 15:34:50 +04:00
add_subdirectory ( doc )
2021-06-02 17:21:28 +04:00
if ( ADMC_BUILD_DEB )
SET ( CPACK_GENERATOR "DEB" )
SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Kees van Vloten" )
SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
SET ( CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
SET ( CPACK_DEBIAN_PACKAGE_DESCRIPTION "Samba domain management console." )
SET ( CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/altlinux/admc" )
2021-06-02 17:45:26 +04:00
set ( CPACK_STRIP_FILES "${CMAKE_INSTALL_LIBDIR}/libadldap.so;${CMAKE_INSTALL_BINDIR}/admc" )
2021-06-02 17:21:28 +04:00
INCLUDE ( CPack )
endif ( ADMC_BUILD_DEB )