2009-02-02 17:44:46 +03:00
project ( libssh C )
# Required cmake version
cmake_minimum_required ( VERSION 2.6.0 )
# global needed variables
set ( APPLICATION_NAME ${ PROJECT_NAME } )
set ( APPLICATION_VERSION_MAJOR "0" )
2009-07-25 18:32:10 +04:00
set ( APPLICATION_VERSION_MINOR "4" )
2009-02-02 17:44:46 +03:00
set ( APPLICATION_VERSION_PATCH "0" )
2009-12-21 17:56:21 +03:00
set ( APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}" )
2009-07-30 02:46:07 +04:00
set ( LIBRARY_VERSION "4.0.0" )
set ( LIBRARY_SOVERSION "4" )
2009-02-02 17:44:46 +03:00
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set ( CMAKE_MODULE_PATH
$ { C M A K E _ S O U R C E _ D I R } / c m a k e / M o d u l e s
)
# add definitions
include ( DefineCMakeDefaults )
include ( DefineCompilerFlags )
include ( DefineInstallationPaths )
include ( DefineOptions.cmake )
include ( CPackConfig.cmake )
# disallow in-source build
include ( MacroEnsureOutOfSourceBuild )
macro_ensure_out_of_source_build ( "${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there." )
# add macros
include ( MacroAddPlugin )
include ( MacroCopyFile )
# search for libraries
find_package ( ZLIB REQUIRED )
2009-09-26 01:31:48 +04:00
if ( WITH_GCRYPT )
find_package ( GCrypt REQUIRED )
2009-05-07 19:07:54 +04:00
if ( NOT GCRYPT_FOUND )
2009-09-26 01:31:48 +04:00
message ( FATAL_ERROR "Could not find GCrypt" )
2009-05-07 19:07:54 +04:00
endif ( NOT GCRYPT_FOUND )
2009-09-26 01:31:48 +04:00
else ( WITH_GCRYPT )
find_package ( OpenSSL )
if ( NOT CRYPTO_FOUND )
find_package ( GCrypt )
if ( NOT GCRYPT_FOUND )
message ( FATAL_ERROR "Could not find OpenSSL or GCrypt" )
endif ( NOT GCRYPT_FOUND )
endif ( NOT CRYPTO_FOUND )
endif ( WITH_GCRYPT )
2009-02-02 17:44:46 +03:00
# config.h checks
include ( ConfigureChecks.cmake )
configure_file ( config.h.cmake ${ CMAKE_CURRENT_BINARY_DIR } /config.h )
# check subdirectories
2009-02-03 13:43:45 +03:00
add_subdirectory ( doc )
2009-02-02 17:44:46 +03:00
add_subdirectory ( include )
add_subdirectory ( libssh )
2009-12-30 08:34:17 +03:00
# pkg-config file
configure_file ( libssh.pc.cmake ${ CMAKE_CURRENT_BINARY_DIR } /libssh.pc )
install (
F I L E S
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / l i b s s h . p c
D E S T I N A T I O N
$ { L I B _ I N S T A L L _ D I R } / p k g c o n f i g
C O M P O N E N T
p k g c o n f i g
)
2009-03-08 17:05:41 +03:00
if ( UNIX AND NOT WIN32 )
2009-07-30 13:40:28 +04:00
add_subdirectory ( examples )
2009-03-08 17:05:41 +03:00
endif ( UNIX AND NOT WIN32 )