2010-03-04 11:48:36 -06:00
# CMakeLists.txt for the cutecash sub-project of gnucash
# This is very EXPERIMENTAL! We will see how far this project will
# get.
2015-12-07 11:17:08 -06:00
IF ( WIN32 )
CMAKE_MINIMUM_REQUIRED ( VERSION 3.3.2 )
ELSE ( )
2016-01-13 10:45:29 -06:00
CMAKE_MINIMUM_REQUIRED ( VERSION 3.0 )
2015-12-07 11:17:08 -06:00
ENDIF ( )
PROJECT ( Gnucash )
2016-01-18 10:33:34 -06:00
ENABLE_TESTING ( )
2015-12-07 11:17:08 -06:00
# Version number of gnucash
SET ( GNUCASH_MAJOR_VERSION 2 )
SET ( GNUCASH_MINOR_VERSION 6 )
2016-12-17 13:11:56 -06:00
SET ( GNUCASH_MICRO_VERSION 15 )
2015-12-07 11:17:08 -06:00
SET ( GNUCASH_NANO_VERSION 0 )
SET ( VERSION "${GNUCASH_MAJOR_VERSION}.${GNUCASH_MINOR_VERSION}.${GNUCASH_MICRO_VERSION}" )
SET ( GNUCASH_LATEST_STABLE_SERIES 2.6 )
SET ( PACKAGE gnucash )
SET ( PACKAGE_NAME GnuCash )
2015-12-26 10:55:15 -06:00
SET ( PACKAGE_VERSION ${ VERSION } )
2015-12-07 11:17:08 -06:00
SET ( PACKAGE_BUGREPORT gnucash-devel@gnucash.org )
SET ( PACKAGE_TARNAME ${ PACKAGE } )
SET ( PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}" )
SET ( PACKAGE_URL "" )
2010-05-06 06:40:55 -05:00
2011-01-30 04:25:07 -06:00
# Change this in development versions when changing anything that
# affects stored data structures. Reset to zero when bumping version.
2015-12-07 11:17:08 -06:00
2011-02-02 14:31:10 -06:00
SET ( GNUCASH_RESAVE_VERSION "19920" )
2011-01-30 04:25:07 -06:00
2015-12-07 11:17:08 -06:00
SET ( GETTEXT_PACKAGE "gnucash" )
2010-03-04 11:48:36 -06:00
# Extra cmake macros
SET ( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/src/cmake_modules;${CMAKE_MODULE_PATH}" )
INCLUDE ( MacroAppendForeach )
INCLUDE ( MacroAddSourceFileCompileFlags )
INCLUDE ( GncAddSwigCommand )
2010-05-06 06:40:55 -05:00
INCLUDE ( CheckIncludeFiles )
2015-12-07 11:17:08 -06:00
INCLUDE ( GncAddSchemeTargets )
INCLUDE ( GncConfigure )
INCLUDE ( GncAddGSchemaTargets )
2016-01-18 10:33:34 -06:00
INCLUDE ( GncAddTest )
2010-03-04 11:48:36 -06:00
2015-12-07 11:17:08 -06:00
# ############################################################
# These options are settable from the CMake command line. For example, to disable
# SQL, put -D WITH_SQL=OFF on the command line.
OPTION ( WITH_SQL "Build this project with SQL (libdbi) support" ON )
OPTION ( WITH_AQBANKING "Build this project with aqbanking (online banking) support" ON )
OPTION ( WITH_GNUCASH "Build all of GnuCash, not just cutecash" ON )
OPTION ( WITH_CUTECASH "Also build cutecash" OFF )
OPTION ( WITH_OFX "compile with ofx support (needs LibOFX)" ON )
2016-08-26 13:59:33 -05:00
OPTION ( WITH_PYTHON "enable python plugin and bindings" OFF )
2015-12-07 11:17:08 -06:00
OPTION ( ENABLE_BINRELOC "compile with binary relocation support" ON )
OPTION ( ENABLE_DEBUG "compile with debugging flags set" OFF )
OPTION ( ENABLE_REGISTER2 "compile with register2 enabled" OFF )
OPTION ( DISABLE_NLS "do not use Native Language Support" OFF )
2017-01-16 16:03:50 -06:00
OPTION ( DISABLE_DEPRECATED_GLIB "don't use deprecated glib functions" OFF )
2015-12-07 11:17:08 -06:00
OPTION ( DISABLE_DEPRECATED_GTK "don't use deprectacted gtk, gdk or gdk-pixbuf functions" OFF )
OPTION ( DISABLE_DEPRECATED_GNOME "don't use deprecated gnome functions" OFF )
OPTION ( GNC_BUILD_AS_INSTALL "Make build directory structure mirror install" ON )
2010-03-04 11:48:36 -06:00
# ############################################################
2015-12-07 11:17:08 -06:00
# These are also settable from the command line in a similar way.
2010-03-27 15:27:10 -05:00
2015-12-07 11:17:08 -06:00
SET ( BINDIR ${ CMAKE_INSTALL_PREFIX } /bin CACHE STRING "user executables" )
SET ( SYSCONFDIR ${ CMAKE_INSTALL_PREFIX } /etc CACHE STRING "read-only single-machine data" )
SET ( DATAROOTDIR ${ CMAKE_INSTALL_PREFIX } /share CACHE STRING "read-only arch.-independent data root" )
SET ( DATADIR ${ DATAROOTDIR } CACHE STRING "read-only architecture-independent data" )
SET ( LIBDIR ${ CMAKE_INSTALL_PREFIX } /lib CACHE STRING "object code libraries" )
SET ( LOCALEDIR ${ DATAROOTDIR } /locale CACHE STRING "locale-dependent data" )
SET ( GNC_HELPDIR ${ DATADIR } CACHE STRING "where to store help files" )
SET ( DATADIRNAME share )
SET ( GNC_SYSTEM_XDG_DATA_DIRS /usr/local/share /usr/share )
SET ( GNC_DBD_DIR ${ CMAKE_PREFIX_PATH } /lib/dbd CACHE PATH "specify location of libdbi drivers" )
SET ( PKGLIBDIR ${ CMAKE_INSTALL_PREFIX } /lib/gnucash )
2016-01-18 10:33:34 -06:00
SET ( TEST_MYSQL_URL "" CACHE STRING "MySQL database URL for testing" )
SET ( TEST_PGSQL_URL "" CACHE STRING "PgSQL database URL for testing" )
2016-07-14 20:44:09 -05:00
SET ( HTMLHELP_DIR ${ CMAKE_PREFIX_PATH } /hh CACHE PATH "Specify location of Win32 HTMLHELP library" )
2015-12-07 11:17:08 -06:00
IF ( GNC_BUILD_AS_INSTALL )
SET ( DATADIR_BUILD ${ CMAKE_BINARY_DIR } / ${ DATADIRNAME } )
SET ( LIBDIR_BUILD ${ CMAKE_BINARY_DIR } /lib )
SET ( SYSCONFDIR_BUILD ${ CMAKE_BINARY_DIR } /etc )
SET ( BINDIR_BUILD ${ CMAKE_BINARY_DIR } /bin )
ENDIF ( )
2010-03-27 15:27:10 -05:00
2016-01-18 10:33:34 -06:00
SET ( SHELL_FROM_ENV $ENV{ SHELL } )
2016-01-27 14:50:51 -06:00
SET ( SHELL /bin/bash )
IF ( WIN32 )
SET ( SHELL ${ CMAKE_PREFIX_PATH } /mingw/msys/1.0/bin/bash.exe )
ENDIF ( )
2016-01-18 10:33:34 -06:00
IF ( SHELL_FROM_ENV ) # Replacing this with IF ($ENV{SHELL}) doesn't work.
SET ( SHELL ${ SHELL_FROM_ENV } )
ENDIF ( )
2015-12-07 11:17:08 -06:00
2016-08-26 13:59:33 -05:00
# Determine whether we are building from a VCS or from a tarball
EXECUTE_PROCESS (
C O M M A N D $ { S H E L L } $ { C M A K E _ S O U R C E _ D I R } / u t i l / g n c - v c s - i n f o - t $ { C M A K E _ S O U R C E _ D I R }
R E S U L T _ V A R I A B L E G N C _ V C S _ I N F O _ R E S U L T
O U T P U T _ V A R I A B L E G N C _ V C S _ I N F O _ O U T P U T
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
)
SET ( BUILDING_FROM_VCS "NO" )
IF ( GNC_VCS_INFO_RESULT EQUAL 0 )
SET ( BUILDING_FROM_VCS "YES" )
ENDIF ( )
2015-12-07 11:17:08 -06:00
IF ( WIN32 )
# Help Windows find the various dependencies. We assume here that the standard advice for building
# GnuCash has been followed and that these dependencies live underneath something like C:/GCDEV, which
# should be provided as CMAKE_PREFIX_PATH on the CMake command line:
# cmake -D CMAKE_PREFIX_PATH=c/gcdev -G "MSYS Makefiles" path/to/gnucash/sources
#
SET ( CMAKE_FRAMEWORK_PATH_TMP ${ CMAKE_PREFIX_PATH } )
SET ( DEV_SUBDIRS aqbanking gnome goffice guile gwenhywfar libgsf libofx libsoup libxslt webkit )
FOREACH ( subdir ${ DEV_SUBDIRS } )
LIST ( APPEND CMAKE_FRAMEWORK_PATH_TMP ${ CMAKE_PREFIX_PATH } / ${ subdir } )
ENDFOREACH ( )
# Setting CMAKE_FRAMEWORK_PATH, which is intended for OS X, is a terrible hack here. But I don't
# want to mess with CMAKE_PREFIX_PATH.
SET ( CMAKE_FRAMEWORK_PATH "${CMAKE_FRAMEWORK_PATH_TMP}" )
SET ( PKG_CONFIG_EXECUTABLE ${ CMAKE_PREFIX_PATH } /gnome/bin/pkg-config.exe )
SET ( SWIG_EXECUTABLE ${ CMAKE_PREFIX_PATH } /swig/swig.exe )
SET ( BOOST_ROOT ${ CMAKE_PREFIX_PATH } /boost )
SET ( REGEX_INCLUDE_PATH ${ CMAKE_PREFIX_PATH } /regex/include )
SET ( REGEX_LDFLAGS "-L${CMAKE_PREFIX_PATH}/regex/lib -lregex" )
SET ( LIBXSLT_INCLUDE_DIR ${ CMAKE_PREFIX_PATH } /libxslt/include )
SET ( LIBXSLT_XSLTPROC_EXECUTABLE ${ CMAKE_PREFIX_PATH } /libxslt/bin/xsltproc )
# I have not yet debugged the intltool-merge file generation process on Windows.
SET ( NO_INTLTOOL TRUE )
2016-08-20 15:14:34 -05:00
#Prevent creating a console window on startup.
SET ( CMAKE_EXE_LINKER_FLAGS -mwindows )
2015-12-07 11:17:08 -06:00
ENDIF ( WIN32 )
IF ( APPLE )
SET ( CMAKE_OSX_ARCHITECTURES "i386" )
ADD_DEFINITIONS ( -arch i386 )
#SET(CMAKE_OSX_ARCHITECTURES "x86_64")
# For PPC build, uncomment these lines (untested):
#SET (CMAKE_OSX_ARCHITECTURES "i386;ppc")
#ADD_DEFINITIONS(-arch i386 -arch ppc
#SET (AC_APPLE_UNIVERSAL_BUILD 1)
ENDIF ( APPLE )
FIND_PACKAGE ( PkgConfig REQUIRED )
# The default FindPkgConfig.make code has a bug in how the setting of PKG_CONFIG_PATH is handled.
# The src/cmake_modules/GncFindPkgConfig.cmake file overrides a couple of macros in FindPkgConfig to fix.
INCLUDE ( GncFindPkgConfig )
2010-03-04 11:48:36 -06:00
IF ( NOT PKG_CONFIG_FOUND )
MESSAGE ( SEND_ERROR "pkg-config not found, but is required" )
ENDIF ( NOT PKG_CONFIG_FOUND )
# glib et al.
2015-12-07 11:17:08 -06:00
GNC_PKG_CHECK_MODULES ( GLIB2 REQUIRED glib-2.0>=2.20 )
GNC_PKG_CHECK_MODULES ( GOBJECT REQUIRED gobject-2.0>=2.20 )
GNC_PKG_CHECK_MODULES ( GMODULE REQUIRED gmodule-2.0>=2.20 )
GNC_PKG_CHECK_MODULES ( GTHREAD REQUIRED gthread-2.0>=2.20 )
GNC_PKG_CHECK_MODULES ( LIBXML2 REQUIRED libxml-2.0>=2.7.0 )
GNC_PKG_CHECK_MODULES ( GNOMECANVAS REQUIRED libgnomecanvas-2.0 )
GNC_PKG_CHECK_MODULES ( LIBXSLT REQUIRED libxslt )
GNC_PKG_CHECK_MODULES ( WEBKIT REQUIRED webkit-1.0>=1.2 )
IF ( WITH_GNUCASH )
GNC_PKG_CHECK_MODULES ( GTK2 REQUIRED gtk+-2.0>=2.24.0 )
GNC_PKG_CHECK_MODULES ( GOFFICE REQUIRED libgoffice-0.8>=0.8.17 )
ENDIF ( WITH_GNUCASH )
GNC_PKG_CHECK_MODULES ( ZLIB REQUIRED zlib )
IF ( WITH_CUTECASH )
GNC_PKG_CHECK_MODULES ( GLIBMM REQUIRED glibmm-2.4>=2.24 )
ENDIF ( WITH_CUTECASH )
2010-03-04 11:48:36 -06:00
IF ( MSVC )
MESSAGE ( STATUS "Hint: To create the import libraries for the gnome DLLs (e.g. gconf-2.lib), use the dlltool as follows: pexports bin/libgconf-2-4.dll > lib/libgconf-2.def ; dlltool -d lib/libgconf-2.def -D bin/libgconf-2-4.dll -l lib/gconf-2.lib" )
2010-03-11 15:59:45 -06:00
# Disable the obnoxious min/max macros in MSVC - we want to use the
# function versions of them.
ADD_DEFINITIONS ( -DNOMINMAX )
2010-03-04 11:48:36 -06:00
ENDIF ( MSVC )
FIND_PATH ( LIBINTL_INCLUDE_PATH NAMES libintl.h
P A T H S / u s r / i n c l u d e / o p t / g n o m e / i n c l u d e )
FIND_LIBRARY ( LIBINTL_LIBRARY NAMES intl )
2015-12-07 11:17:08 -06:00
FIND_PATH ( LTDL_INCLUDE_PATH NAMES ltdl.h PATHS /usr/include )
IF ( NOT LTDL_INCLUDE_PATH-NOTFOUND )
SET ( HAVE_LTDL_H 1 )
ENDIF ( )
FIND_PROGRAM ( INTLTOOL_MERGE NAMES intltool-merge HINTS ${ CMAKE_PREFIX_PATH } /gnome/bin )
FIND_PROGRAM ( GLIB_COMPILE_SCHEMAS glib-compile-schemas HINTS ${ CMAKE_PREFIX_PATH } /gnome/bin )
FIND_PROGRAM ( MSGFMT msgfmt )
IF ( NOT INTLTOOL_MERGE )
MESSAGE ( SEND_ERROR "Can't find intltool-merge program. Please set INTLTOOL_MERGE." )
ENDIF ( NOT INTLTOOL_MERGE )
IF ( NOT GLIB_COMPILE_SCHEMAS )
MESSAGE ( SEND_ERROR "Can't find glib-compile-schemas program. Please set GLIB_COMPILE_SCHEMAS." )
ENDIF ( NOT GLIB_COMPILE_SCHEMAS )
IF ( NOT MSGFMT )
MESSAGE ( SEND_ERROR "Can't find msgfmt program. Please set MSGFMT." )
ENDIF ( NOT MSGFMT )
2010-03-04 11:48:36 -06:00
FIND_PATH ( REGEX_INCLUDE_PATH NAMES regex.h
P A T H S / u s r / i n c l u d e / o p t / g n o m e / i n c l u d e )
FIND_LIBRARY ( REGEX_LIBRARY NAMES regex )
2010-03-14 16:01:32 -05:00
IF ( WIN32 )
2016-07-14 20:44:09 -05:00
FIND_PATH ( HTMLHELP_INCLUDE_PATH NAMES htmlhelp.h HINTS ${ HTMLHELP_DIR } /include )
FIND_LIBRARY ( HTMLHELP_LIBRARY htmlhelp HINTS ${ HTMLHELP_DIR } /lib )
2010-03-14 16:01:32 -05:00
ENDIF ( WIN32 )
2010-03-04 11:48:36 -06:00
# ############################################################
# SWIG
2016-08-26 13:59:33 -05:00
IF ( BUILDING_FROM_VCS )
FIND_PACKAGE ( SWIG REQUIRED )
INCLUDE ( ${ SWIG_USE_FILE } )
ENDIF ( )
2010-03-04 11:48:36 -06:00
2015-12-07 11:17:08 -06:00
# Find Guile and determine which version we are using.
# First look for guile-2.0. If not found, try to locate guile-1.8
2010-03-06 05:00:54 -06:00
# guile library and include dir
2015-12-07 11:17:08 -06:00
GNC_PKG_CHECK_MODULES ( GUILE2 guile-2.0>=2.0.9 QUIET )
IF ( GUILE2_FOUND ) # found guile-2.0
ADD_DEFINITIONS ( -DHAVE_GUILE20 )
SET ( HAVE_GUILE2 TRUE )
SET ( GUILE_EFFECTIVE_VERSION 2.0 )
SET ( GUILE_INCLUDE_DIRS ${ GUILE2_INCLUDE_DIRS } )
SET ( GUILE_LDFLAGS ${ GUILE2_LDFLAGS } )
2016-01-27 14:50:51 -06:00
FIND_PROGRAM ( GUILD_EXECUTABLE guild )
2015-12-07 11:17:08 -06:00
IF ( NOT GUILD_EXECUTABLE )
MESSAGE ( SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE." )
ENDIF ( NOT GUILD_EXECUTABLE )
MESSAGE ( STATUS "Using guile-2.0.x" )
ELSE ( )
# look for guile 1.8
GNC_PKG_CHECK_MODULES ( GUILE1 guile-1.8>=1.8.8 QUIET )
IF ( NOT GUILE1_FOUND )
MESSAGE ( SEND_ERROR "Neither guile 1.8 nor guile 2.0 where find. Please set PKG_CONFIG_PATH one of these is found." )
ENDIF ( NOT GUILE1_FOUND )
SET ( HAVE_GUILE1 TRUE )
SET ( GUILE_EFFECTIVE_VERSION 1.8 )
2016-01-27 14:50:51 -06:00
SET ( GUILE_INCLUDE_DIRS ${ GUILE1_INCLUDE_DIRS } )
SET ( GUILE_LDFLAGS ${ GUILE1_LDFLAGS } )
2015-12-07 11:17:08 -06:00
MESSAGE ( STATUS "Using guile-1.8.x" )
ENDIF ( )
2016-01-27 14:50:51 -06:00
FIND_PROGRAM ( GUILE_EXECUTABLE guile )
IF ( NOT GUILE_EXECUTABLE )
MESSAGE ( SEND_ERROR "The guile executable was not found, but is required. Please set GUILE_EXECUTABLE." )
ENDIF ( NOT GUILE_EXECUTABLE )
2015-12-07 11:17:08 -06:00
# Qt
IF ( WITH_CUTECASH )
SET ( QT_MIN_VERSION "4.5.0" )
FIND_PACKAGE ( Qt4 REQUIRED ) # find and setup Qt4 for this project
ENDIF ( WITH_CUTECASH )
# ############################################################
IF ( WITH_AQBANKING )
GNC_PKG_CHECK_MODULES ( GWENHYWFAR REQUIRED gwenhywfar )
GNC_PKG_CHECK_MODULES ( AQBANKING REQUIRED aqbanking )
IF ( WITH_GNUCASH )
GNC_PKG_CHECK_MODULES ( GWENGUI_GTK2 REQUIRED gwengui-gtk2 )
GNC_PKG_CHECK_MODULES ( KTOBLZCHECK ktoblzcheck )
IF ( KTOBLZCHECK_FOUND )
SET ( HAVE_KTOBLZCHECK_H 1 )
ENDIF ( KTOBLZCHECK_FOUND )
ENDIF ( WITH_GNUCASH )
ENDIF ( WITH_AQBANKING )
IF ( WITH_OFX )
GNC_PKG_CHECK_MODULES ( LIBOFX REQUIRED libofx )
2016-09-11 16:48:24 -05:00
INCLUDE ( CheckCXXSourceRuns )
2016-10-20 12:40:18 -05:00
IF ( WIN32 )
SET ( CMAKE_REQUIRED_LIBRARIES "-L ${CMAKE_PREFIX_PATH}/libofx/lib -lofx" )
ELSE ( WIN32 )
SET ( CMAKE_REQUIRED_LIBRARIES "-lofx" )
ENDIF ( WIN32 )
CHECK_CXX_SOURCE_RUNS ( "
2016-09-11 16:48:24 -05:00
#include <time.h>
#include <stdlib.h>
#include <string>
e x t e r n t i m e _ t ofxdate_to_time_t ( const std::string ofxdate ) ;
i n t main ( int argc, char** argv )
{
c o n s t s t d : : s t r i n g t i m e s t r = \ " 2 0 1 6 0 3 1 9 0 0 0 0 0 0 \ " ;
s t r u c t t m t s ;
t s . t m _ y e a r = 1 1 6 ;
t s . t m _ m o n = 2 ;
t s . t m _ m d a y = 1 9 ;
2016-10-20 12:40:18 -05:00
#ifdef _WIN32
putenv ( \"TZ=PST-8PDT-7,M 4.1.0/0,M 10.6.0/0\ " ) ;
#else
setenv ( \"TZ\", \"PST 08P DT 07 M 4.1.0, M 10.6.0\ " , 1 ) ;
#endif
2016-09-11 16:48:24 -05:00
t i m e _ t t = ofxdate_to_time_t ( timestr ) ;
if ( t == mktime(&ts ) )
exit ( 1 ) ;
exit ( 0 ) ;
}
" H A V E _ O F X _ B U G _ 3 9 )
SET ( HAVE_OFX_BUG_39 ${ HAVE_OFX_BUG_39 } )
SET ( CMAKE_REQUIRED_LIBRARIES )
2015-12-07 11:17:08 -06:00
ENDIF ( WITH_OFX )
# ############################################################
IF ( APPLE )
EXECUTE_PROCESS (
C O M M A N D $ { P K G _ C O N F I G _ E X E C U T A B L E } - - v a r i a b l e = t a r g e t g d k - 2 . 0
O U T P U T _ V A R I A B L E T A R G E T _ R E S U L T
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
)
IF ( TARGET_RESULT STREQUAL "quartz" )
SET ( GNC_PLATFORM_COCOA 1 )
SET ( GDK_QUARTZ 1 )
GNC_PKG_CHECK_MODULES ( GTK_MAC gtk-mac-integration-gtk2 )
IF ( GTK_MAC_FOUND )
SET ( MAC_INTEGRATION 1 )
FIND_LIBRARY ( COCOA_LIBRARY Cocoa )
FIND_LIBRARY ( SECURITY_LIBRARY Security )
FIND_LIBRARY ( CARBON_LIBRARY Carbon )
SET ( OSX_EXTRA_COMPILE_FLAGS -xobjective-c )
SET ( OSX_EXTRA_LIBRARIES objc ${ COCOA_LIBRARY } ${ SECURITY_LIBRARY } ${ CARBON_LIBRARY } )
ENDIF ( GTK_MAC_FOUND )
ENDIF ( )
ENDIF ( APPLE )
2010-03-04 11:48:36 -06:00
# ############################################################
2015-04-22 15:33:58 -05:00
# xsltproc
2015-12-07 11:17:08 -06:00
FIND_PACKAGE ( LibXslt )
2015-04-22 15:33:58 -05:00
2015-12-07 11:17:08 -06:00
IF ( NOT LIBXSLT_FOUND )
MESSAGE ( SEND_ERROR "libxslt library not found." )
ENDIF ( NOT LIBXSLT_FOUND )
2015-04-22 15:33:58 -05:00
# ############################################################
2010-03-27 15:27:10 -05:00
# libdbi
2015-12-07 11:17:08 -06:00
FIND_PATH ( LIBDBI_INCLUDE_PATH dbi/dbi.h HINTS ${ CMAKE_PREFIX_PATH } /libdbi/include )
FIND_LIBRARY ( LIBDBI_LIBRARY dbi HINTS ${ CMAKE_PREFIX_PATH } /libdbi/lib )
FIND_PATH ( LIBDBI_DRIVERS_DIR dbd HINTS ${ CMAKE_PREFIX_PATH } /lib ${ CMAKE_PREFIX_PATH } /libdbi-drivers/lib )
2010-03-27 15:27:10 -05:00
IF ( WITH_SQL )
IF ( NOT LIBDBI_INCLUDE_PATH )
MESSAGE ( SEND_ERROR "Include file <dbi/dbi.h> was not found - did you install libdbi0-dev or libdbi-dev?" )
ENDIF ( NOT LIBDBI_INCLUDE_PATH )
IF ( NOT LIBDBI_LIBRARY )
MESSAGE ( SEND_ERROR "Library libdbi was not found" )
ENDIF ( NOT LIBDBI_LIBRARY )
2015-12-07 11:17:08 -06:00
SET ( HAVE_DBI_DBI_H 1 )
2010-03-27 15:27:10 -05:00
ENDIF ( WITH_SQL )
# ############################################################
2016-08-26 13:59:33 -05:00
IF ( WITH_PYTHON )
FIND_PACKAGE ( PythonInterp )
IF ( NOT PYTHONINTERP_FOUND )
MESSAGE ( SEND_ERROR "Python support enabled, but Python interpreter not found." )
ENDIF ( )
IF ( PYTHON_VERSION_STRING VERSION_LESS "2.4.0" )
MESSAGE ( SEND_ERROR "Found python version ${PYTHON_VERSION_STRING}, but it's too old. Need python >= 2.4.0" )
ENDIF ( )
FIND_PACKAGE ( PythonLibs )
IF ( NOT PYTHONLIBS_FOUND )
MESSAGE ( SEND_ERROR "Python support enabled, but Python libraries not found." )
ENDIF ( )
ENDIF ( )
2015-12-07 11:17:08 -06:00
FIND_PACKAGE ( Perl )
2010-03-04 11:48:36 -06:00
2015-12-07 11:17:08 -06:00
if ( NOT PERL_FOUND )
MESSAGE ( SEND_ERROR "Perl executable not found. Please set PERL_EXECUTABLE." )
ENDIF ( NOT PERL_FOUND )
2016-07-16 14:12:58 -05:00
GET_FILENAME_COMPONENT ( PERL_DIR ${ PERL_EXECUTABLE } DIRECTORY )
FIND_PROGRAM ( POD2MAN_EXECUTABLE pod2man HINTS ${ PERL_DIR } )
2015-12-07 11:17:08 -06:00
2015-12-26 10:55:15 -06:00
# Boost stuff removed, not required on maint.
2010-03-04 11:48:36 -06:00
# Compiler flags
2015-12-07 11:17:08 -06:00
IF ( APPLE )
ADD_DEFINITIONS ( -Wno-unknown-attributes -Wno-typedef-redefinition )
# SET (CMAKE_OSX_ARCHITECTURES "i386")
ENDIF ( APPLE )
# Also, set the C++ version to c++11
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11" ) # FIXME: should be -std=c++11
2010-03-04 11:48:36 -06:00
IF ( UNIX )
2016-07-02 16:08:14 -05:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -D_FORTIFY_SOURCE=2 -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -std=gnu99" )
2013-11-18 02:00:44 -06:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-declarations" )
2010-03-04 11:48:36 -06:00
ENDIF ( UNIX )
IF ( MINGW )
2015-12-07 11:17:08 -06:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -std=gnu99" )
2010-03-04 11:48:36 -06:00
ENDIF ( MINGW )
2015-12-07 11:17:08 -06:00
IF ( APPLE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedef" )
ENDIF ( APPLE )
IF ( APPLE AND WITH_GNUCASH )
SET ( CMAKE_MACOSX_RPATH ON )
ENDIF ( APPLE AND WITH_GNUCASH )
IF ( UNIX AND NOT APPLE )
SET ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/gnucash" )
ENDIF ( )
SET ( BUILD_SHARED_LIBS ON )
IF ( GNC_BUILD_AS_INSTALL )
# Most libraries are installed to lib/gnucash, so set that as the default.
# For the handful that are installed to lib, we override the properies below
# (after the targets have been read in).
SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ CMAKE_BINARY_DIR } /lib/gnucash )
IF ( XCODE_VERSION )
# FIXME: These settings break the ability to manipulate different configurations (Debug,
# FIXME: Release, etc.) in Xcode. We'll need to change the module loading C code if
# we want to support multi config.
SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${ CMAKE_BINARY_DIR } /lib/gnucash )
SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${ CMAKE_BINARY_DIR } /lib/gnucash )
ENDIF ( )
# For binarines
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ CMAKE_BINARY_DIR } /bin )
IF ( XCODE_VERSION )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${ CMAKE_BINARY_DIR } /bin )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${ CMAKE_BINARY_DIR } /bin )
ENDIF ( )
ENDIF ( )
2010-03-04 11:48:36 -06:00
# ############################################################
2016-01-18 10:33:34 -06:00
SET ( CMAKE_CTEST_COMMAND ctest )
IF ( XCODE_VERSION )
SET ( CMAKE_CTEST_COMMAND ctest -C Debug )
ENDIF ( )
# There are targets that need to build before tests will run
ADD_CUSTOM_TARGET ( check
C O M M A N D $ { C M A K E _ C T E S T _ C O M M A N D }
D E P E N D S g n u c a s h s c m - a p p - u t i l s s c m - g n o m e - u t i l s s c m - r e p o r t - g n o m e
s c m - e n g i n e s c m - g n c - m o d u l e s c m - t e s t - e n g i n e s c m - r e p o r t - s y s t e m - 3
s c m - t e s t - c o r e s c m - t e s t - r e p o r t - s y s t e m s c m - s t a n d a r d - r e p o r t s - 2
s c m - t e s t - s t a n d a r d - r e p o r t s f o o g n c m o d f o o b a z g n c m o d b a z
b a r g n c m o d b a r g n c m o d _ a g e d v e r g n c m o d _ i n c o m p a t d e p
2016-01-27 14:50:51 -06:00
g n c m o d _ f u t u r e m o d s y s t e s t - c o r e - g u i l e
2016-01-18 10:33:34 -06:00
)
IF ( NOT WIN32 )
ADD_DEPENDENCIES ( check gncmod-backend-xml-link )
ENDIF ( )
2010-03-04 11:48:36 -06:00
# The subdirectories
2015-12-07 11:17:08 -06:00
ADD_SUBDIRECTORY ( accounts )
ADD_SUBDIRECTORY ( checks )
ADD_SUBDIRECTORY ( doc )
2016-08-26 13:59:33 -05:00
ADD_SUBDIRECTORY ( packaging )
2015-12-07 11:17:08 -06:00
ADD_SUBDIRECTORY ( po )
2010-03-04 11:48:36 -06:00
ADD_SUBDIRECTORY ( src )
2010-04-12 14:21:14 -05:00
2015-12-07 11:17:08 -06:00
# This cmake subdir must be the last add_subdirectory() call because
# it contains post-install actions to execute.
ADD_SUBDIRECTORY ( cmake )
IF ( GNC_BUILD_AS_INSTALL )
SET_TARGET_PROPERTIES ( gnc-qof gnc-core-utils gnc-module gnc-backend-sql gnc-backend-xml-utils
g n c - b u s i n e s s - l e d g e r g n c - g n o m e P R O P E R T I E S
L I B R A R Y _ O U T P U T _ D I R E C T O R Y $ { C M A K E _ B I N A R Y _ D I R } / l i b
IF ( XCODE_VERSION )
L I B R A R Y _ O U T P U T _ D I R E C T O R Y _ D E B U G $ { C M A K E _ B I N A R Y _ D I R } / l i b
L I B R A R Y _ O U T P U T _ D I R E C T O R Y _ R E L E A S E $ { C M A K E _ B I N A R Y _ D I R } / l i b
ENDIF ( )
R U N T I M E _ O U T P U T _ D I R E C T O R Y $ { C M A K E _ B I N A R Y _ D I R } / b i n
IF ( XCODE_VERSION )
R U N T I M E _ O U T P U T _ D I R E C T O R Y _ D E B U G $ { C M A K E _ B I N A R Y _ D I R } / b i n
R U N T I M E _ O U T P U T _ D I R E C T O R Y _ R E L E A S E $ { C M A K E _ B I N A R Y _ D I R } / b i n
ENDIF ( )
)
IF ( WIN32 )
SET_TARGET_PROPERTIES ( gncmod-backend-xml gncmod-stylesheets gncmod-utility-reports PROPERTIES
L I B R A R Y _ O U T P U T _ D I R E C T O R Y $ { C M A K E _ B I N A R Y _ D I R } / b i n
)
ENDIF ( )
ENDIF ( )
SET ( gnucash_DOCS
A U T H O R S
C h a n g e L o g
2015-12-26 10:55:15 -06:00
C h a n g e L o g . 1 9 9 9
C h a n g e L o g . 2 0 0 0
C h a n g e L o g . 2 0 0 1
C h a n g e L o g . 2 0 0 2
2015-12-07 11:17:08 -06:00
C h a n g e L o g . 2 0 0 3
C h a n g e L o g . 2 0 0 4
C h a n g e L o g . 2 0 0 5
C h a n g e L o g . 2 0 0 6
C h a n g e L o g . 2 0 0 7
C h a n g e L o g . 2 0 0 8
C h a n g e L o g . 2 0 0 9
C h a n g e L o g . 2 0 1 0
C h a n g e L o g . 2 0 1 1
C h a n g e L o g . 2 0 1 2
C h a n g e L o g . 2 0 1 3
C h a n g e L o g . 2 0 1 4
D O C U M E N T E R S
H A C K I N G
L I C E N S E
N E W S
R E A D M E . d e p e n d e n c i e s
)
INSTALL ( FILES ${ gnucash_DOCS } DESTINATION share/doc/gnucash )
2016-01-18 10:33:34 -06:00
#Link LICENSE to COPYING so that people expecting to find it,
#will. COPYING is normally linked by autogen.sh to the latest
#automake-provided version.
2016-01-15 09:03:40 -06:00
SET ( _CMD create_symlink )
IF ( WIN32 )
SET ( _CMD copy )
ENDIF ( )
INSTALL ( CODE
" EXECUTE_PROCESS (
C O M M A N D $ { C M A K E _ C O M M A N D } - E $ { _ C M D } L I C E N S E C O P Y I N G
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ I N S T A L L _ P R E F I X } / s h a r e / d o c / g n u c a s h
) "
)
2015-12-07 11:17:08 -06:00
#For windows, copy in some DLLs from Mingw
IF ( WIN32 )
SET ( MINGW_DLLS ${ CMAKE_PREFIX_PATH } /mingw/bin/libstdc++-6.dll ${ CMAKE_PREFIX_PATH } /mingw/bin/libgcc_s_dw2-1.dll )
INSTALL ( PROGRAMS ${ MINGW_DLLS } DESTINATION bin )
IF ( GNC_BUILD_AS_INSTALL )
FILE ( COPY ${ MINGW_DLLS } DESTINATION ${ BINDIR_BUILD }
# Do permissions matter for windows?
F I L E _ P E R M I S S I O N S O W N E R _ R E A D O W N E R _ W R I T E O W N E R _ E X E C U T E G R O U P _ R E A D G R O U P _ E X E C U T E W O R L D _ R E A D W O R L D _ E X E C U T E
)
ENDIF ( )
2010-04-12 14:21:14 -05:00
2015-12-07 11:17:08 -06:00
ENDIF ( )
2010-04-12 14:21:14 -05:00
# ############################################################
# Package creation rules
2015-12-07 11:17:08 -06:00
IF ( WITH_CUTECASH )
SET ( CUTECASH_VERSION_MAJOR "0" )
SET ( CUTECASH_VERSION_MINOR "1" )
SET ( CUTECASH_VERSION_PATCH "0" )
SET ( CUTECASH_VERSION_NANO "0" )
2010-04-12 14:21:14 -05:00
SET ( CPACK_PACKAGE_NAME "Cutecash" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cutecash Free Finance Software" )
2010-05-06 06:40:55 -05:00
SET ( CPACK_PACKAGE_VERSION_MAJOR ${ CUTECASH_VERSION_MAJOR } )
SET ( CPACK_PACKAGE_VERSION_MINOR ${ CUTECASH_VERSION_MINOR } )
SET ( CPACK_PACKAGE_VERSION_PATCH ${ CUTECASH_VERSION_PATCH } )
2010-04-12 14:21:14 -05:00
SET ( CPACK_PACKAGE_VENDOR "Christian Stimming" )
SET ( CPACK_SOURCE_IGNORE_FILES "/\\\\.svn/;/\\\\.git/;.*~;build.*;html;Debug;Release" )
SET ( CPACK_STRIP_FILES "bin/cutecash" )
#SET (CPACK_PACKAGE_EXECUTABLES "bin/carclient")
2015-12-07 11:17:08 -06:00
ENDIF ( WITH_CUTECASH )
2010-04-12 14:21:14 -05:00
IF ( UNIX )
SET ( CPACK_GENERATOR "TGZ" )
ENDIF ( UNIX )
INCLUDE ( CPack )