2017-02-01 21:48:46 -06:00
# CMakeLists.txt for GnuCash
2010-03-04 11:48:36 -06:00
2017-09-07 00:24:19 -05:00
IF ( WIN32 OR APPLE )
2015-12-07 11:17:08 -06:00
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-26 09:00:54 -06:00
ENABLE_TESTING ( )
2016-01-18 10:33:34 -06:00
2015-12-07 11:17:08 -06:00
# Version number of gnucash
SET ( GNUCASH_MAJOR_VERSION 2 )
2017-09-16 20:01:20 -05:00
SET ( GNUCASH_MINOR_VERSION 7 )
2017-11-25 18:33:30 -06:00
SET ( GNUCASH_MICRO_VERSION 2 )
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 )
2017-11-25 18:33:30 -06:00
SET ( PACKAGE_VERSION 2.7.2 )
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
2017-08-10 06:56:00 -05:00
SET ( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/common/cmake_modules;${CMAKE_MODULE_PATH}" )
2017-06-15 17:39:04 -05:00
# CMake does a non-recursive build that puts the final build product directories in the build root. Some code needs to know this.
2010-03-04 11:48:36 -06:00
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-26 09:00:54 -06:00
INCLUDE ( GncAddTest )
2017-02-01 21:48:46 -06:00
INCLUDE ( MakeDistFiles )
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 )
2017-07-14 16:21:07 -05:00
OPTION ( WITH_AQBANKING "Build this project with aqbanking (online banking) support" ON )
2017-08-09 09:09:32 -05:00
OPTION ( WITH_GNUCASH "Build all of GnuCash, not just the library" ON )
2015-12-07 11:17:08 -06:00
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_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 )
2017-02-02 10:20:39 -06:00
OPTION ( DISABLE_DEPRECATED_GTK "don't use deprecated gtk, gdk or gdk-pixbuf functions" OFF )
2015-12-07 11:17:08 -06:00
OPTION ( DISABLE_DEPRECATED_GNOME "don't use deprecated gnome functions" OFF )
2017-02-01 21:48:46 -06:00
# If AUTOTOOLS_IN_DIST is OFF, then 'dist' wont run autogen.sh, and 'distcheck'
# won't run the autotools distcheck. Note that various Makefile.am files are still
# included in the dist when this is OFF. I'll fix that at some point.
OPTION ( AUTOTOOLS_IN_DIST "Add autotools support to distribution tarballs." 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
2017-10-26 06:30:29 -05:00
SET ( GNUCASH_BUILD_ID "" CACHE STRING "Overrides the GnuCash build identification (Build ID) which defaults to a description of the vcs commit from which gnucash is built. Distributions may want to insert a package management based version number instead" )
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-26 09:00:54 -06:00
SET ( TEST_MYSQL_URL "" CACHE STRING "MySQL database URL for testing" )
SET ( TEST_PGSQL_URL "" CACHE STRING "PgSQL database URL for testing" )
2015-12-07 11:17:08 -06:00
2017-02-01 21:48:46 -06:00
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 )
2010-03-27 15:27:10 -05:00
2016-01-26 09:00:54 -06:00
SET ( SHELL_FROM_ENV $ENV{ SHELL } )
2016-01-27 14:50:51 -06:00
SET ( SHELL /bin/bash )
2017-07-22 15:28:01 -05:00
#We need to distinguish between MinGW.org and MinGW-w64:
IF ( MINGW )
STRING ( FIND ${ CMAKE_C_COMPILER } "msys2" IS_MSYS2 )
IF ( ${ IS_MSYS2 } GREATER_EQUAL 0 )
SET ( MINGW64 ON )
ENDIF ( )
ENDIF ( MINGW )
IF ( MINGW AND NOT MINGW64 ) # /bin/bash will work fine on MinGW
2016-01-27 14:50:51 -06:00
SET ( SHELL ${ CMAKE_PREFIX_PATH } /mingw/msys/1.0/bin/bash.exe )
ENDIF ( )
2016-01-26 09:00:54 -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" )
2017-02-01 21:48:46 -06:00
# IF building from VCS, we need git
find_package ( Git )
IF ( NOT GIT_FOUND )
2017-10-03 12:42:32 -05:00
MESSAGE ( SEND_ERROR "Looks like we're building from version control, but can't find git executable. Please set GIT_EXECUTABLE." )
2017-02-01 21:48:46 -06:00
ENDIF ( )
2016-08-26 13:59:33 -05:00
ENDIF ( )
2017-02-01 21:48:46 -06:00
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
#
2017-10-26 14:38:50 -05:00
SET ( CMAKE_C_IMPLICIT_LINK_LIBRARIES "" )
2015-12-07 11:17:08 -06:00
SET ( CMAKE_FRAMEWORK_PATH_TMP ${ CMAKE_PREFIX_PATH } )
2017-01-14 07:36:56 -06:00
SET ( DEV_SUBDIRS aqbanking gnome guile gwenhywfar libgsf libofx libsoup libxslt webkit )
2015-12-07 11:17:08 -06:00
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}" )
2017-05-26 15:51:51 -05:00
#SET(PKG_CONFIG_EXECUTABLE ${CMAKE_PREFIX_PATH}/gnome/bin/pkg-config.exe)
SET ( SWIG_EXECUTABLE swig )
#SET(SWIG_EXECUTABLE ${CMAKE_PREFIX_PATH}/swig/swig.exe)
2017-06-05 16:56:18 -05:00
FIND_PATH ( REGEX_INCLUDE_PATH regex.h )
FIND_PATH ( REGEX_LIB_PATH libregex.dll.a )
SET ( REGEX_LDFLAGS "-L${REGEX_LIB_PATH} -lregex" )
2017-05-26 15:51:51 -05:00
#SET(LIBXSLT_INCLUDE_DIR ${CMAKE_PREFIX_PATH}/libxslt/include)
#SET(LIBXSLT_XSLTPROC_EXECUTABLE ${CMAKE_PREFIX_PATH}/libxslt/bin/xsltproc)
2015-12-07 11:17:08 -06:00
# 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 )
FIND_PACKAGE ( PkgConfig REQUIRED )
# The default FindPkgConfig.make code has a bug in how the setting of PKG_CONFIG_PATH is handled.
2017-08-10 06:56:00 -05:00
# The common/cmake_modules/GncFindPkgConfig.cmake file overrides a couple of macros in FindPkgConfig to fix.
2015-12-07 11:17:08 -06:00
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.
2017-03-16 16:21:26 -05:00
GNC_PKG_CHECK_MODULES ( GLIB2 REQUIRED glib-2.0>=2.40 )
2017-08-08 06:46:53 -05:00
GNC_PKG_CHECK_MODULES ( GIO REQUIRED gio-2.0 )
2015-12-07 11:17:08 -06:00
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 ( LIBXSLT REQUIRED libxslt )
2017-10-14 16:26:04 -05:00
IF ( WIN32 OR APPLE )
2017-07-09 12:04:35 -05:00
GNC_PKG_CHECK_MODULES ( WEBKIT REQUIRED webkitgtk-3.0 )
2017-07-08 17:08:07 -05:00
SET ( WEBKIT1 1 )
2017-10-14 16:26:04 -05:00
ELSE ( WIN32 OR APPLE )
2017-07-09 12:04:35 -05:00
GNC_PKG_CHECK_MODULES ( WEBKIT webkit2gtk-4.0 )
IF ( NOT WEBKIT_FOUND )
GNC_PKG_CHECK_MODULES ( WEBKIT REQUIRED webkit2gtk-3.0 )
2017-07-08 17:08:07 -05:00
SET ( WEBKIT2_3 1 )
2017-07-09 12:04:35 -05:00
ELSE ( NOT WEBKIT_FOUND )
2017-07-08 17:08:07 -05:00
SET ( WEBKIT2_4 1 )
2017-07-09 12:04:35 -05:00
ENDIF ( NOT WEBKIT_FOUND )
2017-10-14 16:26:04 -05:00
ENDIF ( WIN32 OR APPLE )
2017-07-08 17:08:07 -05:00
2015-12-07 11:17:08 -06:00
IF ( WITH_GNUCASH )
2017-08-31 08:41:32 -05:00
GNC_PKG_CHECK_MODULES ( GTK3 REQUIRED gtk+-3.0>=3.10.0 )
2015-12-07 11:17:08 -06:00
ENDIF ( WITH_GNUCASH )
GNC_PKG_CHECK_MODULES ( ZLIB REQUIRED zlib )
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 )
2017-08-27 19:27:58 -05:00
message ( STATUS "Looking for htmlhelp.h and htmlhelp.a" )
FIND_PATH ( HTMLHELP_INCLUDE_PATH NAMES htmlhelp.h )
FIND_LIBRARY ( HTMLHELP_LIBRARY htmlhelp )
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 } )
2017-08-31 09:15:19 -05:00
FIND_PROGRAM ( GUILD_EXECUTABLE NAMES guild2.0 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" )
2017-08-31 09:15:19 -05:00
FIND_PROGRAM ( GUILE_EXECUTABLE NAMES guile2.0 guile )
2015-12-07 11:17:08 -06:00
ELSE ( )
# look for guile 1.8
GNC_PKG_CHECK_MODULES ( GUILE1 guile-1.8>=1.8.8 QUIET )
IF ( NOT GUILE1_FOUND )
2017-08-27 19:31:37 -05:00
MESSAGE ( FATAL_ERROR "Neither guile 1.8 nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pgk-config." )
2015-12-07 11:17:08 -06:00
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" )
2017-08-31 09:15:19 -05:00
FIND_PROGRAM ( GUILE_EXECUTABLE NAMES guile1.8 guile )
2015-12-07 11:17:08 -06:00
ENDIF ( )
2010-03-04 11:48:36 -06:00
2016-01-27 14:50:51 -06:00
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
# ############################################################
IF ( WITH_AQBANKING )
GNC_PKG_CHECK_MODULES ( GWENHYWFAR REQUIRED gwenhywfar )
GNC_PKG_CHECK_MODULES ( AQBANKING REQUIRED aqbanking )
IF ( WITH_GNUCASH )
GNC_PKG_CHECK_MODULES ( KTOBLZCHECK ktoblzcheck )
IF ( KTOBLZCHECK_FOUND )
SET ( HAVE_KTOBLZCHECK_H 1 )
ENDIF ( KTOBLZCHECK_FOUND )
ENDIF ( WITH_GNUCASH )
ENDIF ( WITH_AQBANKING )
2014-06-16 13:03:45 -05:00
2015-12-07 11:17:08 -06:00
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 (
2017-07-31 01:29:42 -05:00
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 s g d k - 3 . 0
2015-12-07 11:17:08 -06:00
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 )
2017-07-23 17:49:47 -05:00
GNC_PKG_CHECK_MODULES ( GTK_MAC gtk-mac-integration-gtk3 )
2015-12-07 11:17:08 -06:00
IF ( GTK_MAC_FOUND )
SET ( MAC_INTEGRATION 1 )
FIND_LIBRARY ( COCOA_LIBRARY Cocoa )
FIND_LIBRARY ( SECURITY_LIBRARY Security )
FIND_LIBRARY ( CARBON_LIBRARY Carbon )
2017-09-07 00:24:19 -05:00
SET ( OSX_EXTRA_COMPILE_FLAGS $< $<COMPILE_LANGUAGE:C > :-xobjective-c> $< $<COMPILE_LANGUAGE:CXX > :-xobjective-c++> )
2015-12-07 11:17:08 -06:00
SET ( OSX_EXTRA_LIBRARIES objc ${ COCOA_LIBRARY } ${ SECURITY_LIBRARY } ${ CARBON_LIBRARY } )
ENDIF ( GTK_MAC_FOUND )
ENDIF ( )
ENDIF ( APPLE )
2014-08-29 14:55:12 -05:00
2017-03-13 13:55:09 -05:00
# FIND_PACKAGE(LibXslt) eats PKG_CONFIG_EXECUTABLE, so preserve it.
SET ( GNC_PKG_CONFIG_EXE ${ PKG_CONFIG_EXECUTABLE } )
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
# ############################################################
2017-03-13 13:55:09 -05:00
SET ( PKG_CONFIG_EXECUTABLE ${ GNC_PKG_CONFIG_EXE } )
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 ( )
2017-09-11 15:44:41 -05:00
# Determine where to install the python libraries.
EXECUTE_PROCESS (
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } - c " i m p o r t s y s c o n f i g ; p r i n t s y s c o n f i g . get_path ( 'platlib', vars = { 'platbase' : ' ${ CMAKE_INSTALL_PREFIX } ' } ) "
R E S U L T _ V A R I A B L E P Y T H O N _ S Y S C O N F I G _ R E S U L T
O U T P U T _ V A R I A B L E P Y T H O N _ S Y S C O N F I G _ O U T P U T
E R R O R _ V A R I A B L E P Y T H O N _ S Y S C O N F I G _ E R R O R
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
E R R O R _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
)
IF ( PYTHON_SYSCONFIG_RESULT )
MESSAGE ( SEND_ERROR "Could not determine Python site-package directory:\n${PYTHON_SYSCONFIG_ERROR}" )
ENDIF ( )
STRING ( REPLACE ${ CMAKE_INSTALL_PREFIX } ${ CMAKE_BINARY_DIR } PYTHON_SYSCONFIG_BUILD ${ PYTHON_SYSCONFIG_OUTPUT } )
2016-08-26 13:59:33 -05:00
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
2017-03-13 13:55:09 -05:00
#ICU
GNC_PKG_CHECK_MODULES ( ICU4C REQUIRED icu-uc )
GNC_PKG_CHECK_MODULES ( ICU4C_I18N REQUIRED icu-i18n )
2015-12-07 11:17:08 -06:00
#BOOST
IF ( APPLE )
# I suppose I would rather use the shared Boost libraries here, but the Boost install procedure
# does not set RPATH for it's shared library correctly. It uses a 'naked' RPATH, which requires
2017-02-02 10:20:39 -06:00
# that DYLD_FALLBACK_LIBRARY_PATH be set. There is supposedly a dll-path option to set RPATH, but
2015-12-07 11:17:08 -06:00
# I can't get it to work (http://www.boost.org/build/doc/html/bbv2/faq/dll-path.html) and neither
# can some other random person on the internet:
# http://stackoverflow.com/questions/33667795/dll-path-has-no-effect-when-building-boost
# Using static libs simplifies things.
SET ( Boost_USE_STATIC_LIBS ON )
SET ( Boost_USE_STATIC_RUNTIME ON )
ELSE ( )
SET ( Boost_USE_STATIC_LIBS OFF )
SET ( Boost_USE_STATIC_RUNTIME OFF )
ENDIF ( )
SET ( Boost_USE_MULTITHREADED ON )
SET ( Boost_FIND_QUIETLY ON )
2017-02-02 11:48:15 -06:00
IF ( NOT DEFINED ${ BOOST_ROOT } )
SET ( BOOST_ROOT $ENV{ BOOST_ROOT } )
ENDIF ( )
2017-08-22 09:33:34 -05:00
FIND_PACKAGE ( Boost 1.54.0 REQUIRED COMPONENTS date_time regex locale filesystem )
2015-12-07 11:17:08 -06:00
IF ( Boost_FOUND )
include_directories ( ${ Boost_INCLUDE_DIRS } )
SET ( HAVE_BOOST 1 )
ELSE ( Boost_FOUND )
MESSAGE ( SEND_ERROR "Boost 1.54.0 or later is not installed, and is required. Please install it and ensure that the following libraries are built: chrono, date_time, filesystem, log, program_options, regex, signals, system, and test." )
ENDIF ( Boost_FOUND )
2011-05-03 15:08:34 -05:00
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-08-04 16:41:18 -05:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused" )
2017-03-31 04:13:13 -05:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations -std=gnu11" )
2016-08-04 16:41:18 -05:00
SET ( CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" )
2010-03-04 11:48:36 -06:00
ENDIF ( UNIX )
IF ( MINGW )
2017-06-15 17:39:04 -05:00
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -Wno-error=deprecated-declarations -std=gnu11" )
2017-04-17 13:52:16 -05:00
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0500 -D_EMULATE_GLIBC=0" ) # Workaround for bug in gtest on mingw, see https://github.com/google/googletest/issues/893 and https://github.com/google/googletest/issues/920
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 )
2016-08-04 16:41:18 -05:00
SET ( CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS}" )
2017-03-31 04:13:13 -05:00
SET ( CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
2015-12-07 11:17:08 -06:00
IF ( APPLE AND WITH_GNUCASH )
SET ( CMAKE_MACOSX_RPATH ON )
2017-10-15 15:22:29 -05:00
SET ( CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" )
2015-12-07 11:17:08 -06:00
ENDIF ( APPLE AND WITH_GNUCASH )
2017-10-15 15:22:29 -05:00
IF ( UNIX )
2015-12-07 11:17:08 -06:00
SET ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/gnucash" )
2016-01-26 11:30:00 -06:00
ENDIF ( )
2015-12-07 11:17:08 -06:00
SET ( BUILD_SHARED_LIBS ON )
2017-02-01 21:48:46 -06:00
# 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).
2015-12-07 11:17:08 -06:00
2017-02-01 21:48:46 -06:00
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 )
2015-12-07 11:17:08 -06:00
ENDIF ( )
2010-03-04 11:48:36 -06:00
2017-02-01 21:48:46 -06:00
# For binarines
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ CMAKE_BINARY_DIR } /bin )
2016-01-26 09:00:54 -06:00
IF ( XCODE_VERSION )
2017-02-01 21:48:46 -06:00
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${ CMAKE_BINARY_DIR } /bin )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${ CMAKE_BINARY_DIR } /bin )
2016-01-26 09:00:54 -06:00
ENDIF ( )
2017-02-01 21:48:46 -06:00
# ############################################################
2016-01-18 10:33:34 -06:00
2017-07-04 20:36:35 -05:00
GNC_GTEST_CONFIGURE ( )
2016-01-18 10:33:34 -06:00
# There are targets that need to build before tests will run
2016-01-26 09:00:54 -06:00
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
2017-08-07 04:37:53 -05:00
g n c m o d _ f u t u r e m o d s y s c h e c k - p o t e s t - c o r e - g u i l e g n c m o d - b a c k e n d - x m l
2016-01-26 09:00:54 -06:00
)
2015-12-07 11:17:08 -06:00
SET ( gnucash_DOCS
A U T H O R S
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
2017-09-06 13:43:43 -05:00
C h a n g e L o g . 2 0 1 5
C h a n g e L o g . 2 0 1 6
2015-12-07 11:17:08 -06:00
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
)
2017-02-01 21:48:46 -06:00
2015-12-07 11:17:08 -06:00
INSTALL ( FILES ${ gnucash_DOCS } DESTINATION share/doc/gnucash )
2017-08-09 10:30:59 -05:00
# ############################################################
# Create config.h
SET ( GETTEXT_PACKAGE "gnucash" )
IF ( WIN32 )
2017-08-10 06:56:00 -05:00
IF ( MINGW )
SET ( HAVE_SCANF_LLD 1 )
ELSE ( )
SET ( HAVE_SCANF_I64D 1 )
ENDIF ( )
SET ( HAVE_HTMLHELPW 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( WIN32 )
CHECK_INCLUDE_FILES ( dirent.h HAVE_DIRENT_H )
CHECK_INCLUDE_FILES ( dlfcn.h HAVE_DLFCN_H )
CHECK_INCLUDE_FILES ( glob.h HAVE_GLOB_H )
CHECK_INCLUDE_FILES ( inttypes.h HAVE_INTTYPES_H )
CHECK_INCLUDE_FILES ( limits.h HAVE_LIMITS_H )
CHECK_INCLUDE_FILES ( locale.h HAVE_LOCALE_H )
CHECK_INCLUDE_FILES ( memory.h HAVE_MEMORY_H )
CHECK_INCLUDE_FILES ( stdint.h HAVE_STDINT_H )
CHECK_INCLUDE_FILES ( stdlib.h HAVE_STDLIB_H )
CHECK_INCLUDE_FILES ( string.h HAVE_STRING_H )
CHECK_INCLUDE_FILES ( strings.h HAVE_STRINGS_H )
CHECK_INCLUDE_FILES ( sys/stat.h HAVE_SYS_STAT_H )
CHECK_INCLUDE_FILES ( sys/time.h HAVE_SYS_TIME_H )
CHECK_INCLUDE_FILES ( sys/times.h HAVE_SYS_TIMES_H )
CHECK_INCLUDE_FILES ( sys/types.h HAVE_SYS_TYPES_H )
CHECK_INCLUDE_FILES ( sys/wait.h HAVE_SYS_WAIT_H )
CHECK_INCLUDE_FILES ( unistd.h HAVE_UNISTD_H )
CHECK_INCLUDE_FILES ( utmp.h HAVE_UTMP_H )
CHECK_INCLUDE_FILES ( wctype.h HAVE_WCTYPE_H )
IF ( NOT DISABLE_NLS )
2017-08-10 06:56:00 -05:00
SET ( ENABLE_NLS 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( NOT DISABLE_NLS )
IF ( ENABLE_BINRELOC )
2017-08-10 06:56:00 -05:00
IF ( UNIX OR MINGW )
SET ( BR_PTHREAD 1 )
ENDIF ( UNIX OR MINGW )
2017-08-09 10:30:59 -05:00
ENDIF ( ENABLE_BINRELOC )
IF ( UNIX OR MINGW )
2017-08-10 06:56:00 -05:00
SET ( HAVE_BIND_TEXTDOMAIN_CODESET 1 )
SET ( HAVE_DCGETTEXT 1 )
SET ( HAVE_GETTEXT 1 )
SET ( HAVE_GETTIMEOFDAY 1 )
SET ( HAVE_GUILE 1 )
SET ( HAVE_LIBM 1 )
SET ( HAVE_MEMCPY 1 )
SET ( STDC_HEADERS 1 )
SET ( _ALL_SOURCE 1 )
SET ( _GNU_SOURCE 1 )
SET ( _POSIX_PTHREAD_SEMANTICS 1 )
SET ( _TANDEM_SOURCE 1 )
SET ( __EXTENSIONS__ 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( UNIX OR MINGW )
IF ( UNIX )
2017-08-10 06:56:00 -05:00
SET ( HAVE_CHOWN 1 )
SET ( HAVE_DLERROR 1 )
SET ( HAVE_DLSYM 1 )
SET ( HAVE_GETHOSTID 1 )
SET ( HAVE_GETHOSTNAME 1 )
SET ( HAVE_GETPPID 1 )
SET ( HAVE_GETUID 1 )
SET ( HAVE_GMTIME_R 1 )
SET ( HAVE_LANGINFO_D_FMT 1 )
SET ( HAVE_LC_MESSAGES 1 )
SET ( HAVE_LIBPTHREAD 1 )
SET ( HAVE_LINK 1 )
SET ( HAVE_LOCALTIME_R 1 )
SET ( HAVE_PTHREAD_MUTEX_INIT 1 )
SET ( HAVE_PTHREAD_PRIO_INHERIT 1 )
SET ( HAVE_SCANF_LLD 1 )
SET ( HAVE_SETENV 1 )
SET ( HAVE_STPCPY 1 )
SET ( HAVE_STRFMON 1 )
SET ( HAVE_STRPTIME 1 )
SET ( HAVE_STRUCT_TM_GMTOFF 1 )
SET ( HAVE_TIMEGM 1 )
SET ( HAVE_TOWUPPER 1 )
SET ( GNC_PLATFORM_POSIX 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( UNIX )
IF ( WIN32 )
2017-08-10 06:56:00 -05:00
SET ( GNC_PLATFORM_WINDOWS 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( WIN32 )
IF ( APPLE )
# FIXME: HANDLE gtk-mac-integration-gtk2
2017-08-10 06:56:00 -05:00
SET ( GNC_PLATFORM_DARWIN 1 )
SET ( GNC_PLATFORM_OSX 1 )
SET ( PLATFORM_OSX 1 )
SET ( HAVE_OSX_KEYCHAIN 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( APPLE )
IF ( GLIB2_VERSION VERSION_GREATER 2.46.0 OR GLIB2_VERSION VERSION_EQUAL 2.46.0 )
2017-08-10 06:56:00 -05:00
SET ( HAVE_GLIB_2_46 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( )
IF ( DISABLE_DEPRECATED_GNOME )
2017-08-10 06:56:00 -05:00
SET ( GNOME_DISABLE_DEPRECATED 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( DISABLE_DEPRECATED_GNOME )
IF ( DISABLE_DEPRECATED_GTK )
2017-08-10 06:56:00 -05:00
SET ( GTK_DISABLE_DEPRECATED 1 )
SET ( GDK_DISABLE_DEPRECATED 1 )
SET ( GDK_PIXMAP_DISABLE_DEPRECATED 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( DISABLE_DEPRECATED_GTK )
IF ( DISABLE_DEPRECATED_GLIB )
2017-08-10 06:56:00 -05:00
SET ( G_DISABLE_DEPRECATED 1 )
2017-08-09 10:30:59 -05:00
ENDIF ( DISABLE_DEPRECATED_GLIB )
ADD_DEFINITIONS ( -DHAVE_CONFIG_H )
2017-08-10 06:56:00 -05:00
SET ( CONFIG_H ${ CMAKE_CURRENT_BINARY_DIR } /common/config.h )
CONFIGURE_FILE ( ${ CMAKE_CURRENT_SOURCE_DIR } /common/config.h.cmake.in ${ CONFIG_H } )
2017-08-09 10:30:59 -05:00
SET ( SCHEME_INSTALLED_SOURCE_DIR ${ CMAKE_INSTALL_PREFIX } /share/gnucash/scm )
SET ( SCHEME_INSTALLED_CACHE_DIR ${ CMAKE_INSTALL_PREFIX } /lib/gnucash/scm/ccache/ ${ GUILE_EFFECTIVE_VERSION } )
2017-02-01 21:48:46 -06:00
# The subdirectories
2017-08-17 08:25:41 -05:00
ADD_SUBDIRECTORY ( borrowed )
2017-08-11 15:14:31 -05:00
ADD_SUBDIRECTORY ( data )
2017-02-01 21:48:46 -06:00
ADD_SUBDIRECTORY ( doc )
ADD_SUBDIRECTORY ( macros )
ADD_SUBDIRECTORY ( po )
2017-08-10 06:56:00 -05:00
ADD_SUBDIRECTORY ( common )
ADD_SUBDIRECTORY ( libgnucash )
IF ( WITH_GNUCASH )
ADD_SUBDIRECTORY ( gnucash )
ENDIF ( WITH_GNUCASH )
ADD_SUBDIRECTORY ( bindings )
2017-02-01 21:48:46 -06:00
ADD_SUBDIRECTORY ( test-templates )
ADD_SUBDIRECTORY ( util )
# This cmake subdir must be the last add_subdirectory() call because
# it contains post-install actions to execute.
ADD_SUBDIRECTORY ( cmake )
############################ BEGIN MAKE DIST #################
SET ( PACKAGE_PREFIX "${PACKAGE}-${PACKAGE_VERSION}" )
SET ( DIST_FILE "${PACKAGE_PREFIX}.tar" )
2017-08-10 06:56:00 -05:00
SET ( toplvl_DIST_local ${ gnucash_DOCS } ChangeLog.2015 ChangeLog.2016
2017-07-04 20:36:35 -05:00
C M a k e L i s t s . t x t c o n f i g u r e . a c M a k e f i l e . a m m a k e - g n u c a s h - p o t f i l e s . i n R E A D M E )
2017-02-01 21:48:46 -06:00
IF ( BUILDING_FROM_VCS AND AUTOTOOLS_IN_DIST )
2017-08-10 06:56:00 -05:00
SET ( toplvl_DIST_local ${ toplvl_DIST_local } autogen.sh )
2017-02-01 21:48:46 -06:00
ENDIF ( )
2017-08-10 06:56:00 -05:00
SET_LOCAL_DIST ( toplvl_DIST ${ toplvl_DIST_local } )
2017-02-01 21:48:46 -06:00
# Each subdirectory is responsible for reporting its list of distribution files to its parent, up to here.
#
# Leaf directories use the SET_DIST_LIST() function to report their distribution files. See
2017-08-10 06:56:00 -05:00
# the bottom of libgnucash/app-utils/test/CMakeLists.txt for an example.
2017-02-01 21:48:46 -06:00
#
# A non leaf directories uses the SET_LOCAL_DIST() function to specify its distribution files local that dir,
# then uses a (SET ${foo_DIST} ${locals....} PARENT_SCOPE) command to report up. See the bottom of
2017-08-10 06:56:00 -05:00
# libgnucash/app-utils/CMakeLists.txt for an example of this.
2017-02-01 21:48:46 -06:00
2017-08-17 08:25:41 -05:00
SET ( ALL_DIST ${ bindings_DIST } ${ borrowed_DIST } ${ cmake_DIST } ${ common_DIST } ${ data_DIST }
$ { d o c _ D I S T } $ { g n u c a s h _ D I S T } $ { l i b g n u c a s h _ D I S T } $ { m a c r o s _ D I S T } $ { p a c k a g i n g _ D I S T }
2017-08-10 06:56:00 -05:00
$ { p o _ D I S T } $ { t e s t _ t e m p l a t e s _ D I S T } $ { t o p l v l _ D I S T } $ { u t i l _ D I S T } )
2017-02-01 21:48:46 -06:00
IF ( BUILDING_FROM_VCS )
SET ( BUILD_SOURCE_DIR ${ CMAKE_BINARY_DIR } )
ELSE ( )
SET ( BUILD_SOURCE_DIR ${ CMAKE_SOURCE_DIR } )
IF ( AUTOTOOLS_IN_DIST )
# Include autotools generated file in the dist
LIST ( APPEND ALL_DIST compile config.guess config.sub configure depcomp install-sh missing
2017-08-10 06:56:00 -05:00
l i b g n u c a s h / d o c / d e s i g n / m d a t e - s h l i b g n u c a s h / d o c / d e s i g n / t e x i n f o . t e x )
2017-02-01 21:48:46 -06:00
IF ( EXISTS ${ CMAKE_SOURCE_DIR } /test-driver ) # test-driver only created for automake 1.12+.
LIST ( APPEND ALL_DIST test-driver )
ENDIF ( )
ENDIF ( )
ENDIF ( )
# Write a dist manifest
STRING ( REPLACE ";" "\n" ALL_DIST_LINES "${ALL_DIST}" )
FILE ( WRITE ${ CMAKE_BINARY_DIR } /dist_manifest.txt ${ ALL_DIST_LINES } )
SET ( DIST_GENERATED_FILES "" )
FOREACH ( file ${ COPY_FROM_BUILD } )
LIST ( APPEND DIST_GENERATED_FILES2 ${ BUILD_SOURCE_DIR } / ${ file } )
ENDFOREACH ( )
ADD_CUSTOM_COMMAND ( OUTPUT ${ DIST_FILE } .gz ${ DIST_FILE } .bz2
C O M M A N D $ { C M A K E _ C O M M A N D }
2017-08-10 06:56:00 -05:00
- D C M A K E _ M O D U L E _ P A T H = $ { C M A K E _ S O U R C E _ D I R } / c o m m o n / c m a k e _ m o d u l e s
2017-02-01 21:48:46 -06:00
- D P A C K A G E _ P R E F I X = $ { P A C K A G E _ P R E F I X }
- D G N U C A S H _ S O U R C E _ D I R = $ { C M A K E _ S O U R C E _ D I R }
- D B U I L D _ S O U R C E _ D I R = $ { B U I L D _ S O U R C E _ D I R }
- D B U I L D I N G _ F R O M _ V C S = $ { B U I L D I N G _ F R O M _ V C S }
- D S H E L L = $ { S H E L L }
- D A U T O T O O L S _ I N _ D I S T = $ { A U T O T O O L S _ I N _ D I S T }
2017-08-10 06:56:00 -05:00
- P $ { C M A K E _ S O U R C E _ D I R } / c o m m o n / c m a k e _ m o d u l e s / M a k e D i s t . c m a k e
2017-02-01 21:48:46 -06:00
D E P E N D S
$ { A L L _ D I S T } $ { D I S T _ G E N E R A T E D _ F I L E S 2 } g n c - v c s - i n f o i s o - 4 2 1 7 - c g n c - w a r n i n g s - c b u i l d - c o n f i g - s c m g n u c a s h - d e s i g n - i n f o C h a n g e L o g
)
ADD_CUSTOM_TARGET ( dist DEPENDS ${ DIST_FILE } .gz ${ DIST_FILE } .bz2 )
ADD_CUSTOM_TARGET ( distcheck DEPENDS dist
C O M M A N D $ { C M A K E _ C O M M A N D }
2017-08-10 06:56:00 -05:00
- D C M A K E _ M O D U L E _ P A T H = $ { C M A K E _ S O U R C E _ D I R } / c o m m o n / c m a k e _ m o d u l e s
2017-02-01 21:48:46 -06:00
- D C M A K E _ P R E F I X _ P A T H = $ { C M A K E _ P R E F I X _ P A T H }
- D P A C K A G E _ P R E F I X = $ { P A C K A G E _ P R E F I X }
- D C M A K E _ C _ F L A G S = $ { C M A K E _ C _ F L A G S }
- D C M A K E _ C X X _ F L A G S = $ { C M A K E _ C X X _ F L A G S }
- D A U T O T O O L S _ I N _ D I S T = $ { A U T O T O O L S _ I N _ D I S T }
2017-08-10 06:56:00 -05:00
- P $ { C M A K E _ S O U R C E _ D I R } / c o m m o n / c m a k e _ m o d u l e s / M a k e D i s t C h e c k . c m a k e
2017-02-01 21:48:46 -06:00
)
############################# END MAKE DIST #################
# uninstall target
configure_file (
" $ { C M A K E _ S O U R C E _ D I R } / c m a k e / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
@ O N L Y )
add_custom_target ( uninstall
C O M M A N D $ { C M A K E _ C O M M A N D } - P $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e )
2017-08-06 10:12:16 -05:00
SET_TARGET_PROPERTIES ( gnc-core-utils gnc-module gnc-backend-sql gnc-backend-xml-utils
2011-11-19 12:29:27 -06:00
g n c - g n o m e P R O P E R T I E S
2017-02-01 21:48:46 -06:00
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 )
2017-08-27 19:32:21 -05:00
SET_TARGET_PROPERTIES ( gncmod-backend-xml gncmod-stylesheets PROPERTIES
2017-02-01 21:48:46 -06:00
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 ( )
# Generate the ChangeLog
IF ( BUILDING_FROM_VCS )
ADD_CUSTOM_TARGET ( ChangeLog ALL
C O M M A N D $ { G I T _ E X E C U T A B L E } l o g - - f o r m a t = \ " % a d % a N % n % n % x 0 9 * % s % d % n \ " - - d a t e = s h o r t - - s i n c e = 2 0 1 6 - 0 1 - 0 1 > $ { C M A K E _ B I N A R Y _ D I R } / C h a n g e L o g
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 }
)
2017-09-06 13:43:43 -05:00
INSTALL ( FILES ${ CMAKE_BINARY_DIR } /ChangeLog DESTINATION share/doc/gnucash )
2017-02-01 21:48:46 -06:00
ELSE ( )
2017-10-28 16:21:39 -05:00
INSTALL ( FILES ${ CMAKE_SOURCE_DIR } /ChangeLog DESTINATION share/doc/gnucash )
2017-02-01 21:48:46 -06:00
ENDIF ( )
2016-01-15 12:38:23 -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
2010-04-12 14:21:14 -05:00
2015-12-07 11:17:08 -06:00
IF ( WIN32 )
2017-06-05 16:56:18 -05:00
FIND_LIBRARY ( LIBSTDC++ libstdc++-6.dll )
FIND_LIBRARY ( LIBDW2 libgcc_s_dw2-1.dll )
SET ( MINGW_DLLS ${ LIBSTDC++ } ${ LIBDW2 } )
2015-12-07 11:17:08 -06:00
INSTALL ( PROGRAMS ${ MINGW_DLLS } DESTINATION bin )
2017-02-01 21:48:46 -06:00
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
)
2015-12-07 11:17:08 -06:00
ENDIF ( )
2010-04-12 14:21:14 -05:00
# ############################################################
# Package creation rules
IF ( UNIX )
SET ( CPACK_GENERATOR "TGZ" )
ENDIF ( UNIX )
INCLUDE ( CPack )