gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Tue Jan 12 19:23:38 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/94942196 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/584161c9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/52df775a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/44814868 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1d474968 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e5a4a5c4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4d9440f3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/18011a64 (commit)



commit 9494219603c611b54dcd77fb656f7c6a0a0a1d51
Merge: 52df775 584161c
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jan 12 16:22:57 2016 -0800

    Merge branch 'maint'
    
    Link LICENSE to COPYING.

diff --cc CMakeLists.txt
index b8d7292,879d752..075dcd7
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -438,8 -411,11 +438,12 @@@ IF (GNC_BUILD_AS_INSTALL
      )
    ENDIF()
  ENDIF()
 +# Install DOC files from top level directory
  
+ #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.
+ execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" "${CMAKE_SOURCE_DIR}/LICENSE" "${CMAKE_SOURCE_DIR}/COPYING")
  
  SET(gnucash_DOCS
      AUTHORS

commit 584161c97b4321528e568f736404dfa62dc3ddf0
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jan 12 16:18:31 2016 -0800

    Link LICENSE to COPYING, don't install INSTALL.
    
    The original plan was to duplicate exactly what automake does, but
    we don't really want to do that. Automake installs the GPLV3 COPYING
    which we don't use--LICENSE is the GPLV2 version--and INSTALL is the
    autotools procedure that doesn't make sense for a cmake build.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5421497..879d752 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -412,6 +412,10 @@ IF (GNC_BUILD_AS_INSTALL)
   ENDIF()
 ENDIF()
 
+#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.
+execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" "${CMAKE_SOURCE_DIR}/LICENSE" "${CMAKE_SOURCE_DIR}/COPYING")
 
 SET(gnucash_DOCS
     AUTHORS
@@ -432,6 +436,7 @@ SET(gnucash_DOCS
     ChangeLog.2012
     ChangeLog.2013
     ChangeLog.2014
+    COPYING
     DOCUMENTERS
     HACKING
     LICENSE
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 9589c7a..0795655 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -25,4 +25,3 @@ IF (GNC_BUILD_AS_INSTALL)
 
 ENDIF(GNC_BUILD_AS_INSTALL)
 
-INSTALL(FILES INSTALL COPYING DESTINATION share/doc/gnucash)
\ No newline at end of file
diff --git a/cmake/COPYING b/cmake/COPYING
deleted file mode 100644
index 94a9ed0..0000000
--- a/cmake/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/cmake/INSTALL b/cmake/INSTALL
deleted file mode 100644
index 2099840..0000000
--- a/cmake/INSTALL
+++ /dev/null
@@ -1,370 +0,0 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
-Inc.
-
-   Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.  This file is offered as-is,
-without warranty of any kind.
-
-Basic Installation
-==================
-
-   Briefly, the shell command `./configure && make && make install'
-should configure, build, and install this package.  The following
-more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.  Some packages provide this
-`INSTALL' file but do not implement all of the features documented
-below.  The lack of an optional feature in a given package is not
-necessarily a bug.  More recommendations for GNU packages can be found
-in *note Makefile Conventions: (standards)Makefile Conventions.
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
-   It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
-   The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
-
-   The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.
-
-     Running `configure' might take a while.  While running, it prints
-     some messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Optionally, type `make check' to run any self-tests that come with
-     the package, generally using the just-built uninstalled binaries.
-
-  4. Type `make install' to install the programs and any data files and
-     documentation.  When installing into a prefix owned by root, it is
-     recommended that the package be configured and built as a regular
-     user, and only the `make install' phase executed with root
-     privileges.
-
-  5. Optionally, type `make installcheck' to repeat any self-tests, but
-     this time using the binaries in their final installed location.
-     This target does not install anything.  Running this target as a
-     regular user, particularly if the prior `make install' required
-     root privileges, verifies that the installation completed
-     correctly.
-
-  6. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
-     for the package's developers.  If you use it, you may have to get
-     all sorts of other programs in order to regenerate files that came
-     with the distribution.
-
-  7. Often, you can also type `make uninstall' to remove the installed
-     files again.  In practice, not all packages have tested that
-     uninstallation works correctly, even though it is required by the
-     GNU Coding Standards.
-
-  8. Some packages, particularly those that use Automake, provide `make
-     distcheck', which can by used by developers to test that all other
-     targets like `make install' and `make uninstall' work correctly.
-     This target is generally not run by end users.
-
-Compilers and Options
-=====================
-
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  Run `./configure --help'
-for details on some of the pertinent environment variables.
-
-   You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment.  Here
-is an example:
-
-     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
-
-   *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-   You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you can use GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.  This
-is known as a "VPATH" build.
-
-   With a non-GNU `make', it is safer to compile the package for one
-architecture at a time in the source code directory.  After you have
-installed the package for one architecture, use `make distclean' before
-reconfiguring for another architecture.
-
-   On MacOS X 10.5 and later systems, you can create libraries and
-executables that work on multiple system types--known as "fat" or
-"universal" binaries--by specifying multiple `-arch' options to the
-compiler but only a single `-arch' option to the preprocessor.  Like
-this:
-
-     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-                 CPP="gcc -E" CXXCPP="g++ -E"
-
-   This is not guaranteed to produce working output in all cases, you
-may have to build one architecture at a time and combine the results
-using the `lipo' tool if you have problems.
-
-Installation Names
-==================
-
-   By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc.  You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX', where PREFIX must be an
-absolute file name.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
-PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files still use the regular prefix.
-
-   In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.  In general, the
-default for these options is expressed in terms of `${prefix}', so that
-specifying just `--prefix' will affect all of the other directory
-specifications that were not explicitly provided.
-
-   The most portable way to affect installation locations is to pass the
-correct locations to `configure'; however, many packages provide one or
-both of the following shortcuts of passing variable assignments to the
-`make install' command line to change installation locations without
-having to reconfigure or recompile.
-
-   The first method involves providing an override variable for each
-affected directory.  For example, `make install
-prefix=/alternate/directory' will choose an alternate location for all
-directory configuration variables that were expressed in terms of
-`${prefix}'.  Any directories that were specified during `configure',
-but not in terms of `${prefix}', must each be overridden at install
-time for the entire installation to be relocated.  The approach of
-makefile variable overrides for each directory variable is required by
-the GNU Coding Standards, and ideally causes no recompilation.
-However, some platforms have known limitations with the semantics of
-shared libraries that end up requiring recompilation when using this
-method, particularly noticeable in packages that use GNU Libtool.
-
-   The second method involves providing the `DESTDIR' variable.  For
-example, `make install DESTDIR=/alternate/directory' will prepend
-`/alternate/directory' before all installation names.  The approach of
-`DESTDIR' overrides is not required by the GNU Coding Standards, and
-does not work on platforms that have drive letters.  On the other hand,
-it does better at avoiding recompilation issues, and works well even
-when some directory options were not specified in terms of `${prefix}'
-at `configure' time.
-
-Optional Features
-=================
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-   Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-   Some packages offer the ability to configure how verbose the
-execution of `make' will be.  For these packages, running `./configure
---enable-silent-rules' sets the default to minimal output, which can be
-overridden with `make V=1'; while running `./configure
---disable-silent-rules' sets the default to verbose, which can be
-overridden with `make V=0'.
-
-Particular systems
-==================
-
-   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
-CC is not installed, it is recommended to use the following options in
-order to use an ANSI C compiler:
-
-     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
-
-and if that doesn't work, install pre-built binaries of GCC for HP-UX.
-
-   HP-UX `make' updates targets which have the same time stamps as
-their prerequisites, which makes it generally unusable when shipped
-generated files such as `configure' are involved.  Use GNU `make'
-instead.
-
-   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
-a workaround.  If GNU CC is not installed, it is therefore recommended
-to try
-
-     ./configure CC="cc"
-
-and if that doesn't work, try
-
-     ./configure CC="cc -nodtk"
-
-   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
-directory contains several dysfunctional programs; working variants of
-these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
-in your `PATH', put it _after_ `/usr/bin'.
-
-   On Haiku, software installed for all users goes in `/boot/common',
-not `/usr/local'.  It is recommended to use the following options:
-
-     ./configure --prefix=/boot/common
-
-Specifying the System Type
-==========================
-
-   There may be some features `configure' cannot figure out
-automatically, but needs to determine by the type of machine the package
-will run on.  Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
-a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
-     CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
-     OS
-     KERNEL-OS
-
-   See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
-   If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
-produce code for.
-
-   If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
-   Variables not defined in a site shell script can be set in the
-environment passed to `configure'.  However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost.  In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'.  For example:
-
-     ./configure CC=/usr/local2/bin/gcc
-
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf limitation.  Until the limitation is lifted, you can use
-this workaround:
-
-     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-`configure' Invocation
-======================
-
-   `configure' recognizes the following options to control how it
-operates.
-
-`--help'
-`-h'
-     Print a summary of all of the options to `configure', and exit.
-
-`--help=short'
-`--help=recursive'
-     Print a summary of the options unique to this package's
-     `configure', and exit.  The `short' variant lists options used
-     only in the top level, while the `recursive' variant lists options
-     also present in any nested packages.
-
-`--version'
-`-V'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`--cache-file=FILE'
-     Enable the cache: use and save the results of the tests in FILE,
-     traditionally `config.cache'.  FILE defaults to `/dev/null' to
-     disable caching.
-
-`--config-cache'
-`-C'
-     Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
-     messages will still be shown).
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`--prefix=DIR'
-     Use DIR as the installation prefix.  *note Installation Names::
-     for more details, including other options available for fine-tuning
-     the installation locations.
-
-`--no-create'
-`-n'
-     Run the configure checks, but stop before creating any output
-     files.
-
-`configure' also accepts some other, not widely useful, options.  Run
-`configure --help' for more details.

commit 52df775ada0578c773b366cd9d598e805b1aa067
Merge: 18011a6 4481486
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jan 12 16:14:46 2016 -0800

    Merge branch 'maint'
    
    Reconcile the cmake build.

diff --cc CMakeLists.txt
index 0df8091,5421497..b8d7292
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -438,19 -411,7 +438,8 @@@ IF (GNC_BUILD_AS_INSTALL
      )
    ENDIF()
  ENDIF()
 +# Install DOC files from top level directory
  
- #FILE(WRITE COPYING
- #"This is a placeholder for the COPYING file as generated by automake.
- #If and when CMake becomes the default build system, we will need to
- #put COPYING under version control."
- #)
- 
- #FILE(WRITE INSTALL
- #"This is a placeholder for the INSTALL file as generated by automake.
- #If and when CMake becomes the default build system, we will need to
- #put INSTALL under version control."
- #)
  
  SET(gnucash_DOCS
      AUTHORS
diff --cc cmake/CMakeLists.txt
index 7c664c5,9589c7a..7efce5f
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@@ -23,4 -23,6 +23,6 @@@ IF (GNC_BUILD_AS_INSTALL
  
    ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_DIRECTORY}/gschemas.compiled)
  
- ENDIF(GNC_BUILD_AS_INSTALL)
+ ENDIF(GNC_BUILD_AS_INSTALL)
+ 
 -INSTALL(FILES INSTALL COPYING DESTINATION share/doc/gnucash)
++INSTALL(FILES INSTALL COPYING DESTINATION share/doc/gnucash)
diff --cc po/CMakeLists.txt
index ba7728f,080aed6..264c216
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@@ -45,4 -45,4 +45,4 @@@ ENDIF(
  
  FOREACH(lingua ${ALL_LINGUAS})
    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lingua}.gmo RENAME gnucash.mo DESTINATION share/locale/${lingua}/LC_MESSAGES)
--ENDFOREACH(lingua)
++ENDFOREACH(lingua)
diff --cc src/import-export/aqb/CMakeLists.txt
index 9aa5902,f695ac0..e020122
--- a/src/import-export/aqb/CMakeLists.txt
+++ b/src/import-export/aqb/CMakeLists.txt
@@@ -73,4 -75,4 +73,4 @@@ IF (GNC_BUILD_AS_INSTALL
      DESTINATION ${DATADIR_BUILD}/gnucash/ui)
    FILE(COPY ${aqbanking_GLADE}
      DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
--ENDIF()
++ENDIF()
diff --cc src/libqof/CMakeLists.txt
index 4d9d5bc,4b2f1a2..88afdc2
--- a/src/libqof/CMakeLists.txt
+++ b/src/libqof/CMakeLists.txt
@@@ -45,32 -45,29 +45,33 @@@ SET (gnc_qof_noinst_HEADER
  )
  
  SET (gnc_qof_SOURCES
 -  qof/md5.c
 -  qof/gnc-date.c
 -  qof/gnc-numeric.c
 -  qof/guid.c
 -  qof/kvp-util.c
 -  qof/kvp_frame.c
 -  qof/qofbackend.c
 -  qof/qofbook.c
 -  qof/qofchoice.c
 -  qof/qofclass.c
 -  qof/qofevent.c
 -  qof/qofid.c
 -  qof/qofinstance.c
 -  qof/qoflog.c
 -  qof/qofobject.c
 -  qof/qofquery.c
 -  qof/qofquerycore.c
 -  qof/qofreference.c
 -  qof/qofsession.c
 -  qof/qof-string-cache.c
 -  qof/qofutil.c
 +   qof/gnc-aqbanking-templates.cpp
 +   qof/gnc-date.cpp
 +   qof/gnc-datetime.cpp
 +   qof/gnc-int128.cpp
 +   qof/gnc-numeric.cpp
 +   qof/gnc-rational.cpp
 +   qof/gnc-datetime.cpp
 +   qof/gnc-timezone.cpp
 +   qof/guid.cpp
 +   qof/kvp_frame.cpp
 +   qof/kvp-value.cpp
 +   qof/qofbackend.cpp
 +   qof/qofbook.cpp
 +   qof/qofchoice.cpp
 +   qof/qofclass.cpp
 +   qof/qofevent.cpp
 +   qof/qofid.cpp
 +   qof/qofinstance.cpp
 +   qof/qoflog.cpp
 +   qof/qofobject.cpp
 +   qof/qofquery.cpp
 +   qof/qofquerycore.cpp
 +   qof/qofsession.cpp
 +   qof/qofutil.cpp
 +   qof/qof-string-cache.cpp
  )
+ 
  IF (WIN32)
    ADD_DEFINITIONS (-DOS_WIN32)
    SET (gnc_qof_SOURCES ${gnc_qof_SOURCES}
diff --cc src/report/business-reports/CMakeLists.txt
index 70687af,a03e16f..d69f609
--- a/src/report/business-reports/CMakeLists.txt
+++ b/src/report/business-reports/CMakeLists.txt
@@@ -43,4 -40,4 +43,4 @@@ GNC_ADD_SCHEME_TARGETS(scm-business-rep
    TRUE
  )
  
--INSTALL(FILES ${business_reports_DATA} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/gnucash/report)
++INSTALL(FILES ${business_reports_DATA} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/gnucash/report)
diff --cc src/report/stylesheets/CMakeLists.txt
index 8649c37,8cf782d..acb58a3
--- a/src/report/stylesheets/CMakeLists.txt
+++ b/src/report/stylesheets/CMakeLists.txt
@@@ -77,4 -76,4 +77,4 @@@ INSTALL(FILES ${stylesheets_UI} DESTINA
  IF (GNC_BUILD_AS_INSTALL)
    FILE(COPY ${stylesheets_UI}
      DESTINATION ${DATADIR_BUILD}/gnucash/ui)
--ENDIF()
++ENDIF()
diff --cc src/scm/price-quotes.scm
index 2ab32e4,2a5e1f7..403c2b4
--- a/src/scm/price-quotes.scm
+++ b/src/scm/price-quotes.scm
@@@ -420,36 -412,31 +420,36 @@@
                                                        commodity currency
                                                        gnc-time))
              (if (not (null? saved-price))
 -                (if (>= (gnc-price-get-source saved-price) PRICE-SOURCE-FQ)
 -                    (begin
 -                      (gnc-price-begin-edit saved-price)
 -                      (gnc-price-set-time saved-price gnc-time)
 -                      (gnc-price-set-source saved-price PRICE-SOURCE-FQ)
 -                      (gnc-price-set-typestr saved-price price-type)
 -                      (gnc-price-set-value saved-price price)
 -                      (gnc-price-commit-edit saved-price)
 -                      #f)
 -                    #f)
 -              (let ((gnc-price (gnc-price-create book)))
 -                (if (not gnc-price)
 -                    (string-append
 -                     currency-str ":" (gnc-commodity-get-mnemonic commodity))
 -                    (begin
 -                      (gnc-price-begin-edit gnc-price)
 -                      (gnc-price-set-commodity gnc-price commodity)
 -                      (gnc-price-set-currency gnc-price currency)
 -                      (gnc-price-set-time gnc-price gnc-time)
 -                      (gnc-price-set-source gnc-price PRICE-SOURCE-FQ)
 -                      (gnc-price-set-typestr gnc-price price-type)
 -                      (gnc-price-set-value gnc-price price)
 -                      (gnc-price-commit-edit gnc-price)
 -                      gnc-price)))))
 -          )))
 +                (begin
 +                  (if (gnc-commodity-equiv (gnc-price-get-currency saved-price)
 +                                           commodity)
 +                      (set! price (gnc-numeric-invert price)))
-                   (if (> (gnc-price-get-source saved-price) PRICE-SOURCE-FQ)
++                  (if (>= (gnc-price-get-source saved-price) PRICE-SOURCE-FQ)
 +                      (begin
 +                        (gnc-price-begin-edit saved-price)
 +                        (gnc-price-set-time saved-price gnc-time)
 +                        (gnc-price-set-source saved-price PRICE-SOURCE-FQ)
 +                        (gnc-price-set-typestr saved-price price-type)
 +                        (gnc-price-set-value saved-price price)
 +                        (gnc-price-commit-edit saved-price)
 +                        #f)
 +                      #f))
 +                (let ((gnc-price (gnc-price-create book)))
 +                  (if (not gnc-price)
 +                      (string-append
 +                       currency-str ":" (gnc-commodity-get-mnemonic commodity))
 +                      (begin
 +                        (gnc-price-begin-edit gnc-price)
 +                        (gnc-price-set-commodity gnc-price commodity)
 +                        (gnc-price-set-currency gnc-price currency)
 +                        (gnc-price-set-time gnc-price gnc-time)
 +                        (gnc-price-set-source gnc-price PRICE-SOURCE-FQ)
 +                        (gnc-price-set-typestr gnc-price price-type)
 +                        (gnc-price-set-value gnc-price price)
 +                        (gnc-price-commit-edit gnc-price)
 +                        gnc-price))))
 +            ))
 +      ))
  
    (define (book-add-prices! book prices)
      (let ((pricedb (gnc-pricedb-get-db book)))

commit 448148681f9e212d3023c6e716cefa8fde20f4bb
Author: Rob Gowin <robgowin at gmail.com>
Date:   Sat Dec 26 11:55:15 2015 -0500

    CMake build changes for maint
    
    * Rename various .cpp files back to .c
    
    * Carry copy INSTALL and COPYING from autotools.
    
    * Fix unrelated issue with installing quote scripts.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f01b73..5421497 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,14 +14,14 @@ PROJECT (Gnucash)
 # Version number of gnucash
 SET (GNUCASH_MAJOR_VERSION 2)
 SET (GNUCASH_MINOR_VERSION 6)
-SET (GNUCASH_MICRO_VERSION 99)
+SET (GNUCASH_MICRO_VERSION 11)
 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)
-SET (PACKAGE_VERSION 2.6.99)
+SET (PACKAGE_VERSION ${VERSION})
 SET (PACKAGE_BUGREPORT gnucash-devel at gnucash.org)
 SET (PACKAGE_TARNAME ${PACKAGE})
 SET (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
@@ -321,34 +321,7 @@ ENDIF(NOT PERL_FOUND)
 
 FIND_PROGRAM(POD2MAN_EXECUTABLE pod2man)
 
-#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
-  # that DYLD_FALLBACK_LIBRARY_PATH be set. There is supposedly a dll-path option so set RPATH, but
-  # 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)
-
-FIND_PACKAGE (Boost 1.54.0 REQUIRED COMPONENTS date_time)
-
-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)
-
+# Boost stuff removed, not required on maint.
 
 # Compiler flags
 
@@ -363,7 +336,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")  # FIXME: should be -std=
 
 
 IF (UNIX)
-  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")
+  SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -D_FORTIFY_SOURCE=2 -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -O2 -Wno-unused -std=gnu99")
   SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-declarations")
 ENDIF (UNIX)
 IF (MINGW)
@@ -438,23 +411,15 @@ IF (GNC_BUILD_AS_INSTALL)
     )
   ENDIF()
 ENDIF()
-# Install DOC files from top level directory
 
-FILE(WRITE COPYING
-"This is a placeholder for the COPYING file as generated by automake.
-If and when CMake becomes the default build system, we will need to
-put COPYING under version control."
-)
-
-FILE(WRITE INSTALL
-"This is a placeholder for the INSTALL file as generated by automake.
-If and when CMake becomes the default build system, we will need to
-put INSTALL under version control."
-)
 
 SET(gnucash_DOCS
     AUTHORS
     ChangeLog
+    ChangeLog.1999
+    ChangeLog.2000
+    ChangeLog.2001
+    ChangeLog.2002
     ChangeLog.2003
     ChangeLog.2004
     ChangeLog.2005
@@ -472,8 +437,6 @@ SET(gnucash_DOCS
     LICENSE
     NEWS
     README.dependencies
-    COPYING
-    INSTALL
 )
 
 INSTALL(FILES ${gnucash_DOCS} DESTINATION share/doc/gnucash)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 7c664c5..9589c7a 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -23,4 +23,6 @@ IF (GNC_BUILD_AS_INSTALL)
 
   ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_DIRECTORY}/gschemas.compiled)
 
-ENDIF(GNC_BUILD_AS_INSTALL)
\ No newline at end of file
+ENDIF(GNC_BUILD_AS_INSTALL)
+
+INSTALL(FILES INSTALL COPYING DESTINATION share/doc/gnucash)
\ No newline at end of file
diff --git a/cmake/COPYING b/cmake/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/cmake/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/cmake/INSTALL b/cmake/INSTALL
new file mode 100644
index 0000000..2099840
--- /dev/null
+++ b/cmake/INSTALL
@@ -0,0 +1,370 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
+Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf limitation.  Until the limitation is lifted, you can use
+this workaround:
+
+     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index ba7728f..080aed6 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -3,7 +3,7 @@
 # Set of available languages.
 SET (TP_LINGUAS az ca cs da eu fa ja nl pt rw sk sr sv tr uk zh_CN)
 # already marked as external at TP:
-SET (GC_LINGUAS ar bg de el en_GB es fi fr gu he hi hu it kn ko lt lv mr nb ne pl pt_BR ro ru ta te ur vi zh_TW)
+SET (GC_LINGUAS ar bg de el en_GB es fi fr gu he hi hu it kn ko lt lv mr nb ne pl pt_BR pt_PT ro ru ta te ur vi zh_TW)
 # not marked or no TP team:
 SET (NEW_LINGUAS as brx doi es_NI kok kok at latin ks mai mni mni at bengali)
 
diff --git a/src/backend/dbi/CMakeLists.txt b/src/backend/dbi/CMakeLists.txt
index 8e96b81..ef3cc86 100644
--- a/src/backend/dbi/CMakeLists.txt
+++ b/src/backend/dbi/CMakeLists.txt
@@ -3,7 +3,7 @@
 # Source file gncmod-backend-dbi.c does not appear to be use in Makefile.in, so not included here.
 
 SET (backend_dbi_SOURCES
-  gnc-backend-dbi.cpp
+  gnc-backend-dbi.c
 )
 SET (backend_dbi_noinst_HEADERS
   gnc-backend-dbi.h gnc-backend-dbi-priv.h
diff --git a/src/backend/sql/CMakeLists.txt b/src/backend/sql/CMakeLists.txt
index 4da6bfa..644d165 100644
--- a/src/backend/sql/CMakeLists.txt
+++ b/src/backend/sql/CMakeLists.txt
@@ -3,29 +3,29 @@
 
 
 SET (backend_sql_SOURCES
-  gnc-backend-sql.cpp
-  gnc-account-sql.cpp
-  gnc-address-sql.cpp
-  gnc-bill-term-sql.cpp
-  gnc-book-sql.cpp
-  gnc-budget-sql.cpp
-  gnc-commodity-sql.cpp
-  gnc-customer-sql.cpp
-  gnc-employee-sql.cpp
-  gnc-entry-sql.cpp
-  gnc-invoice-sql.cpp
-  gnc-job-sql.cpp
-  gnc-lots-sql.cpp
-  gnc-order-sql.cpp
-  gnc-owner-sql.cpp
-  gnc-price-sql.cpp
-  gnc-recurrence-sql.cpp
-  gnc-schedxaction-sql.cpp
-  gnc-slots-sql.cpp
-  gnc-tax-table-sql.cpp
-  gnc-transaction-sql.cpp
-  gnc-vendor-sql.cpp
-  escape.cpp
+  gnc-backend-sql.c
+  gnc-account-sql.c
+  gnc-address-sql.c
+  gnc-bill-term-sql.c
+  gnc-book-sql.c
+  gnc-budget-sql.c
+  gnc-commodity-sql.c
+  gnc-customer-sql.c
+  gnc-employee-sql.c
+  gnc-entry-sql.c
+  gnc-invoice-sql.c
+  gnc-job-sql.c
+  gnc-lots-sql.c
+  gnc-order-sql.c
+  gnc-owner-sql.c
+  gnc-price-sql.c
+  gnc-recurrence-sql.c
+  gnc-schedxaction-sql.c
+  gnc-slots-sql.c
+  gnc-tax-table-sql.c
+  gnc-transaction-sql.c
+  gnc-vendor-sql.c
+  escape.c
 )
 SET (backend_sql_noinst_HEADERS
   gnc-account-sql.h
diff --git a/src/backend/xml/CMakeLists.txt b/src/backend/xml/CMakeLists.txt
index 99fd698..3125f77 100644
--- a/src/backend/xml/CMakeLists.txt
+++ b/src/backend/xml/CMakeLists.txt
@@ -34,39 +34,39 @@ SET (backend_xml_utils_noinst_HEADERS
 )
 
 SET (backend_xml_utils_SOURCES
-  gnc-account-xml-v2.cpp
-  gnc-address-xml-v2.cpp
-  gnc-bill-term-xml-v2.cpp
-  gnc-book-xml-v2.cpp
-  gnc-budget-xml-v2.cpp
-  gnc-commodity-xml-v2.cpp
-  gnc-customer-xml-v2.cpp
-  gnc-employee-xml-v2.cpp
-  gnc-entry-xml-v2.cpp
-  gnc-freqspec-xml-v2.cpp
-  gnc-invoice-xml-v2.cpp
-  gnc-job-xml-v2.cpp
-  gnc-lot-xml-v2.cpp
-  gnc-order-xml-v2.cpp
-  gnc-owner-xml-v2.cpp
-  gnc-pricedb-xml-v2.cpp
-  gnc-recurrence-xml-v2.cpp
-  gnc-schedxaction-xml-v2.cpp
-  gnc-tax-table-xml-v2.cpp
-  gnc-transaction-xml-v2.cpp
-  gnc-vendor-xml-v2.cpp
-  gnc-xml-helper.cpp
-  io-example-account.cpp
-  io-gncxml-gen.cpp
-  io-gncxml-v1.cpp
-  io-gncxml-v2.cpp
-  io-utils.cpp
-  sixtp-dom-generators.cpp
-  sixtp-dom-parsers.cpp
-  sixtp-stack.cpp
-  sixtp-to-dom-parser.cpp
-  sixtp-utils.cpp
-  sixtp.cpp
+  gnc-account-xml-v2.c
+  gnc-address-xml-v2.c
+  gnc-bill-term-xml-v2.c
+  gnc-book-xml-v2.c
+  gnc-budget-xml-v2.c
+  gnc-commodity-xml-v2.c
+  gnc-customer-xml-v2.c
+  gnc-employee-xml-v2.c
+  gnc-entry-xml-v2.c
+  gnc-freqspec-xml-v2.c
+  gnc-invoice-xml-v2.c
+  gnc-job-xml-v2.c
+  gnc-lot-xml-v2.c
+  gnc-order-xml-v2.c
+  gnc-owner-xml-v2.c
+  gnc-pricedb-xml-v2.c
+  gnc-recurrence-xml-v2.c
+  gnc-schedxaction-xml-v2.c
+  gnc-tax-table-xml-v2.c
+  gnc-transaction-xml-v2.c
+  gnc-vendor-xml-v2.c
+  gnc-xml-helper.c
+  io-example-account.c
+  io-gncxml-gen.c
+  io-gncxml-v1.c
+  io-gncxml-v2.c
+  io-utils.c
+  sixtp-dom-generators.c
+  sixtp-dom-parsers.c
+  sixtp-stack.c
+  sixtp-to-dom-parser.c
+  sixtp-utils.c
+  sixtp.c
 )
 
 
@@ -95,7 +95,7 @@ INSTALL(TARGETS gnc-backend-xml-utils
 
 # ----
 
-SET(libgncmod_backend_xml_SOURCES gnc-backend-xml.cpp)
+SET(libgncmod_backend_xml_SOURCES gnc-backend-xml.c)
 
 SET_SOURCE_FILES_PROPERTIES (${libgncmod_backend_xml_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
diff --git a/src/import-export/CMakeLists.txt b/src/import-export/CMakeLists.txt
index 55c7fad..4750c44 100644
--- a/src/import-export/CMakeLists.txt
+++ b/src/import-export/CMakeLists.txt
@@ -20,6 +20,7 @@ SET (generic_import_SOURCES
   import-commodity-matcher.c
   import-backend.c
   import-format-dialog.c
+  import-match-map.c
   import-match-picker.c
   import-parse.c
   import-utilities.c
@@ -33,6 +34,7 @@ SET_SOURCE_FILES_PROPERTIES (${generic_import_SOURCES} PROPERTIES OBJECT_DEPENDS
 
 SET (generic_import_HEADERS
   import-parse.h
+  import-match-map.h
 )
 
 SET (generic_import_noinst_HEADERS
diff --git a/src/import-export/aqb/CMakeLists.txt b/src/import-export/aqb/CMakeLists.txt
index 9aa5902..f695ac0 100644
--- a/src/import-export/aqb/CMakeLists.txt
+++ b/src/import-export/aqb/CMakeLists.txt
@@ -10,6 +10,7 @@ SET (aqbanking_SOURCES
   gnc-ab-getbalance.c
   gnc-ab-gettrans.c
   gnc-ab-kvp.c
+  gnc-ab-trans-templ.c
   gnc-ab-transfer.c
   gnc-ab-utils.c
   gnc-file-aqb-import.c
@@ -28,6 +29,7 @@ SET (aqbanking_noinst_HEADERS
   gnc-ab-getbalance.h
   gnc-ab-gettrans.h
   gnc-ab-kvp.h
+  gnc-ab-trans-templ.h
   gnc-ab-transfer.h
   gnc-ab-utils.h
   gnc-file-aqb-import.h
diff --git a/src/import-export/csv-imp/CMakeLists.txt b/src/import-export/csv-imp/CMakeLists.txt
index dc42986..940453e 100644
--- a/src/import-export/csv-imp/CMakeLists.txt
+++ b/src/import-export/csv-imp/CMakeLists.txt
@@ -3,15 +3,11 @@ ADD_SUBDIRECTORY(gschemas)
 SET(csv_import_SOURCES
   gncmod-csv-import.c
   assistant-csv-account-import.c
-  assistant-csv-fixed-trans-import.c
   assistant-csv-trans-import.c
   gnc-plugin-csv-import.c
   csv-account-import.c
-  csv-fixed-trans-import.c
-  gnc-csv-account-map.c
   gnc-csv-model.c
   gnc-csv-gnumeric-popup.c
-  gnc-csv-trans-settings.c
   ${CMAKE_SOURCE_DIR}/lib/stf/stf-parse.c
 )
 
@@ -20,15 +16,11 @@ SET_SOURCE_FILES_PROPERTIES (${csv_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${C
 
 SET(csv_import_noinst_HEADERS
   assistant-csv-account-import.h
-  assistant-csv-fixed-trans-import.h
   assistant-csv-trans-import.h
   gnc-plugin-csv-import.h
   csv-account-import.h
-  csv-fixed-trans-import.h
-  gnc-csv-account-map.h
   gnc-csv-model.h
   gnc-csv-gnumeric-popup.h
-  gnc-csv-trans-settings.h
   ${CMAKE_SOURCE_DIR}/lib/stf/stf-parse.h
 )
 
@@ -51,7 +43,7 @@ INSTALL(TARGETS gncmod-csv-import
 
 # No headers to install
 
-SET(csv_import_GLADE assistant-csv-account-import.glade assistant-csv-fixed-trans-import.glade
+SET(csv_import_GLADE assistant-csv-account-import.glade
       assistant-csv-trans-import.glade)
 
 INSTALL(FILES ${csv_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
diff --git a/src/libqof/CMakeLists.txt b/src/libqof/CMakeLists.txt
index ccc8f46..4b2f1a2 100644
--- a/src/libqof/CMakeLists.txt
+++ b/src/libqof/CMakeLists.txt
@@ -1,80 +1,77 @@
 # CMakeLists.txt for src/libqof
 
 SET (gnc_qof_HEADERS
-    qof/gnc-aqbanking-templates.h
-    qof/gnc-date-p.h
-    qof/gnc-date.h
-    qof/gnc-numeric.h
-    qof/gnc-datetime.hpp
-    qof/gnc-rational.hpp
-    qof/gnc-timezone.hpp
-    qof/guid.h
-    qof/kvp_frame.hpp
-    qof/kvp-value.hpp
-    qof/qof.h
-    qof/qofbackend-p.h
-    qof/qofbackend.h
-    qof/qofbook.h
-    qof/qofbookslots.h
-    qof/qofchoice.h
-    qof/qofclass.h
-    qof/qofevent.h
-    qof/qofid-p.h
-    qof/qofid.h
-    qof/qofinstance-p.h
-    qof/qofinstance.h
-    qof/qoflog.h
-    qof/qofobject.h
-    qof/qofquery.h
-    qof/qofquerycore.h
-    qof/qofsession.h
-    qof/qofutil.h
-    qof/qof-gobject.h
-    qof/qof-string-cache.h
+
+  qof/gnc-date-p.h
+  qof/gnc-date.h
+  qof/gnc-numeric.h
+  qof/guid.h
+  qof/kvp-util-p.h
+  qof/kvp-util.h
+  qof/kvp_frame.h
+  qof/qof.h
+  qof/qofbackend-p.h
+  qof/qofbackend.h
+  qof/qofbook.h
+  qof/qofbookslots.h
+  qof/qofchoice.h
+  qof/qofclass.h
+  qof/qofevent.h
+  qof/qofid-p.h
+  qof/qofid.h
+  qof/qofinstance-p.h
+  qof/qofinstance.h
+  qof/qoflog.h
+  qof/qofobject.h
+  qof/qofquery.h
+  qof/qofquerycore.h
+  qof/qofreference.h
+  qof/qofsession.h
+  qof/qof-string-cache.h
+  qof/qofutil.h
+  qof/qof-gobject.h
+
 )
 SET (gnc_qof_noinst_HEADERS
-    qof/qofbook-p.h
-    qof/qofclass-p.h
-    qof/gnc-date-p.h
-    qof/qofevent-p.h
-    qof/gnc-int128.hpp
-    qof/qofobject-p.h
-    qof/qofquery-p.h
-    qof/qofquerycore-p.h
-    qof/qofsession-p.h
+  qof/md5.h
+  qof/qofbook-p.h
+  qof/qofclass-p.h
+  qof/qofevent-p.h
+  qof/qofmath128-p.h
+  qof/qofobject-p.h
+  qof/qofquery-p.h
+  qof/qofquerycore-p.h
+  qof/qofsession-p.h
 )
 
 SET (gnc_qof_SOURCES
-   qof/gnc-aqbanking-templates.cpp
-   qof/gnc-date.cpp
-   qof/gnc-datetime.cpp
-   qof/gnc-int128.cpp
-   qof/gnc-numeric.cpp
-   qof/gnc-rational.cpp
-   qof/gnc-datetime.cpp
-   qof/gnc-timezone.cpp
-   qof/guid.cpp
-   qof/kvp_frame.cpp
-   qof/kvp-value.cpp
-   qof/qofbackend.cpp
-   qof/qofbook.cpp
-   qof/qofchoice.cpp
-   qof/qofclass.cpp
-   qof/qofevent.cpp
-   qof/qofid.cpp
-   qof/qofinstance.cpp
-   qof/qoflog.cpp
-   qof/qofobject.cpp
-   qof/qofquery.cpp
-   qof/qofquerycore.cpp
-   qof/qofsession.cpp
-   qof/qofutil.cpp
-   qof/qof-string-cache.cpp
+  qof/md5.c
+  qof/gnc-date.c
+  qof/gnc-numeric.c
+  qof/guid.c
+  qof/kvp-util.c
+  qof/kvp_frame.c
+  qof/qofbackend.c
+  qof/qofbook.c
+  qof/qofchoice.c
+  qof/qofclass.c
+  qof/qofevent.c
+  qof/qofid.c
+  qof/qofinstance.c
+  qof/qoflog.c
+  qof/qofobject.c
+  qof/qofquery.c
+  qof/qofquerycore.c
+  qof/qofreference.c
+  qof/qofsession.c
+  qof/qof-string-cache.c
+  qof/qofutil.c
 )
+
 IF (WIN32)
   ADD_DEFINITIONS (-DOS_WIN32)
   SET (gnc_qof_SOURCES ${gnc_qof_SOURCES}
-    qof/qof-win32.cpp
+    qof/qof-win32.c
 	../../lib/libc/strptime.c
 	../../lib/libc/localtime_r.c
 	../../lib/libc/gmtime_r.c
@@ -84,6 +81,10 @@ ENDIF (WIN32)
 # Add dependency on config.h
 SET_SOURCE_FILES_PROPERTIES (${gnc_qof_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
+# Must compile md5.c without strict aliasing, otherwise function md5_finish_ctx
+# gets "dereferencing type-punned pointer will break strict-aliasing rules"
+SET_SOURCE_FILES_PROPERTIES (qof/md5.c PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
+
 ADD_LIBRARY	(gnc-qof
   ${gnc_qof_SOURCES}
   ${gnc_qof_HEADERS}
@@ -111,7 +112,7 @@ INSTALL(TARGETS gnc-qof
 INSTALL(FILES ${gnc_qof_HEADERS} DESTINATION include/gnucash)
 
 SET(qof_test_HEADERS
-    qof/kvp_frame.hpp
+    qof/kvp_frame.h
     qof/qofbook.h
     qof/qofinstance.h
     qof/qofobject.h
diff --git a/src/quotes/CMakeLists.txt b/src/quotes/CMakeLists.txt
index d00ec9e..dd23444 100644
--- a/src/quotes/CMakeLists.txt
+++ b/src/quotes/CMakeLists.txt
@@ -9,11 +9,12 @@ FILE(WRITE ${_TMPDIR}/copy_with_perms.cmake
    FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)"
 )
 
+SET(_BIN_FILES "")
 FOREACH(file gnc-fq-check.in gnc-fq-helper.in gnc-fq-update.in gnc-fq-dump)
   STRING(REPLACE ".in" "" _OUTPUT_FILE_NAME ${file})
   GNC_CONFIGURE2(${file} ${_OUTPUT_FILE_NAME})
   SET(_ABS_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_OUTPUT_FILE_NAME})
-  INSTALL(PROGRAMS ${_ABS_OUPUT_FILE} DESTINATION bin)
+  LIST(APPEND _BIN_FILES ${_ABS_OUTPUT_FILE})
   IF (GNC_BUILD_AS_INSTALL)
     ADD_CUSTOM_COMMAND(
       OUTPUT ${_ABS_OUTPUT_FILE}
@@ -43,4 +44,5 @@ ENDFOREACH(file)
 ADD_CUSTOM_TARGET(quotes-man ALL DEPENDS ${_MAN_FILES})
 ADD_CUSTOM_TARGET(quotes-bin ALL DEPENDS gnc-fq-check gnc-fq-update)
 INSTALL(FILES ${_MAN_FILES} DESTINATION share/man/man1)
+INSTALL(PROGRAMS ${_BIN_FILES} DESTINATION bin)
 
diff --git a/src/report/business-reports/CMakeLists.txt b/src/report/business-reports/CMakeLists.txt
index 70687af..a03e16f 100644
--- a/src/report/business-reports/CMakeLists.txt
+++ b/src/report/business-reports/CMakeLists.txt
@@ -5,7 +5,6 @@ SET (business_reports_SCHEME
   easy-invoice.scm
   fancy-invoice.scm
   taxinvoice.scm
-  receipt.scm
   invoice.scm
   job-report.scm
   owner-report.scm
@@ -18,8 +17,6 @@ SET (business_reports_SCHEME
 SET(business_reports_DATA
   taxinvoice.eguile.scm
   taxinvoice.css
-  receipt.eguile.scm
-  receipt.css
   balsheet-eg.css
   balsheet-eg.eguile.scm
 )
diff --git a/src/report/stylesheets/CMakeLists.txt b/src/report/stylesheets/CMakeLists.txt
index 8649c37..8cf782d 100644
--- a/src/report/stylesheets/CMakeLists.txt
+++ b/src/report/stylesheets/CMakeLists.txt
@@ -35,7 +35,6 @@ SET(stylesheets_SCHEME_1
   stylesheet-fancy.scm
   stylesheet-footer.scm
   stylesheet-easy.scm
-  stylesheet-head-or-tail.scm
 )
 
 SET(stylesheets_SCHEME_2

commit 1d474968cac3185a667b065638282f32af71a2ab
Author: Rob Gowin <robgowin at gmail.com>
Date:   Mon Dec 7 11:17:08 2015 -0600

    Add ability to build GnuCash with CMake
    
    Backported from master.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2a3725..4f01b73 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,48 +3,156 @@
 # This is very EXPERIMENTAL! We will see how far this project will
 # get.
 
-CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
-PROJECT (cutecash)
-
-# Version number of cutecash
-SET (CUTECASH_VERSION_MAJOR "0")
-SET (CUTECASH_VERSION_MINOR "1")
-SET (CUTECASH_VERSION_PATCH "0")
+IF (WIN32)
+  CMAKE_MINIMUM_REQUIRED (VERSION 3.3.2)
+ELSE()
+  CMAKE_MINIMUM_REQUIRED (VERSION 3.1)
+ENDIF()
+
+PROJECT (Gnucash)
+
+# Version number of gnucash
+SET (GNUCASH_MAJOR_VERSION 2)
+SET (GNUCASH_MINOR_VERSION 6)
+SET (GNUCASH_MICRO_VERSION 99)
+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)
+SET (PACKAGE_VERSION 2.6.99)
+SET (PACKAGE_BUGREPORT gnucash-devel at gnucash.org)
+SET (PACKAGE_TARNAME ${PACKAGE})
+SET (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+SET (PACKAGE_URL "")
 
 # Change this in development versions when changing anything that
 # affects stored data structures. Reset to zero when bumping version.
-SET (CUTECASH_VERSION_NANO "0")
+
 SET (GNUCASH_RESAVE_VERSION "19920")
 
+SET(GETTEXT_PACKAGE "gnucash")
+
 # Extra cmake macros
 SET (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/src/cmake_modules;${CMAKE_MODULE_PATH}")
 INCLUDE (MacroAppendForeach)
 INCLUDE (MacroAddSourceFileCompileFlags)
 INCLUDE (GncAddSwigCommand)
 INCLUDE (CheckIncludeFiles)
+INCLUDE (GncAddSchemeTargets)
+INCLUDE (GncConfigure)
+INCLUDE (GncAddGSchemaTargets)
 
 # ############################################################
+# 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)
+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)
+OPTION (DISABLE_DEPRECATED_GLIB "don't use deprecated glib funcions" OFF)
+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)
+# ############################################################
 
-OPTION (WITH_SQL "Build this project with SQL (libdbi) support" OFF)
-OPTION (WITH_AQBANKING "Build this project with aqbanking (online banking) support" OFF)
+# These are also settable from the command line in a similar way.
 
-# ############################################################
+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)
+
+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()
 
-# Find pkg-config
-FIND_PACKAGE (PkgConfig REQUIRED)
+
+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(GIT_EXECUTABLE ${CMAKE_PREFIX_PATH}/git-1.9.4/bin/git)
+  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)
+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)
 
 IF (NOT PKG_CONFIG_FOUND)
    MESSAGE (SEND_ERROR "pkg-config not found, but is required")
 ENDIF (NOT PKG_CONFIG_FOUND)
 
 # glib et al.
-PKG_CHECK_MODULES (GLIB2 glib-2.0>=2.20)
-PKG_CHECK_MODULES (GCONF2 gconf-2.0>=2.22)
-PKG_CHECK_MODULES (GOBJECT gobject-2.0>=2.20)
-PKG_CHECK_MODULES (GMODULE gmodule-2.0>=2.20)
-PKG_CHECK_MODULES (GTHREAD gthread-2.0>=2.20)
-PKG_CHECK_MODULES (GLIBMM glibmm-2.4>=2.24)
-PKG_CHECK_MODULES (LIBXML2 libxml-2.0>=2.7.0)
+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)
 
 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")
@@ -54,23 +162,41 @@ IF (MSVC)
   ADD_DEFINITIONS ( -DNOMINMAX )
 ENDIF (MSVC)
 
-## Libxml2
-#FIND_PACKAGE (LibXml2 REQUIRED)
-FIND_PACKAGE (ZLIB REQUIRED)
-
-IF (NOT GLIB2_FOUND)
-   MESSAGE (SEND_ERROR "Glib2 not found, but is required")
-ENDIF (NOT GLIB2_FOUND)
-
 FIND_PATH (LIBINTL_INCLUDE_PATH NAMES libintl.h
 		  PATHS /usr/include /opt/gnome/include)
 FIND_LIBRARY (LIBINTL_LIBRARY NAMES intl)
+
+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)
+
 FIND_PATH (REGEX_INCLUDE_PATH NAMES regex.h
 		  PATHS /usr/include /opt/gnome/include)
 FIND_LIBRARY (REGEX_LIBRARY NAMES regex)
 IF (WIN32)
   FIND_PATH (HTMLHELP_INCLUDE_PATH NAMES htmlhelp.h
-             PATHS /usr/include)
+             PATHS /usr/include
+             HINTS ${CMAKE_PREFIX_PATH}/hh/include)
+  FIND_LIBRARY (HTMLHELP_LIBRARY htmlhelp HINTS ${CMAKE_PREFIX_PATH}/hh/lib)
 ENDIF (WIN32)
 
 # ############################################################
@@ -79,29 +205,102 @@ ENDIF (WIN32)
 FIND_PACKAGE (SWIG REQUIRED)
 INCLUDE (${SWIG_USE_FILE})
 
+# Find Guile and determine which version we are using.
+# First look for guile-2.0. If not found, try to locate guile-1.8
+
 # guile library and include dir
-PKG_CHECK_MODULES (GUILE guile-1.8>=1.8.0)
-ADD_DEFINITIONS (-DHAVE_GUILE18)
-# We also need to look up the executable
-FIND_PROGRAM (GUILE_EXECUTABLE guile)
-
-IF (NOT GUILE_FOUND)
-  MESSAGE (SEND_ERROR "Guile was not found, but is required. Please set PKG_CONFIG_PATH so that guile-1.8.pc is found.")
-ENDIF (NOT GUILE_FOUND)
-IF (NOT GUILE_EXECUTABLE)
-  MESSAGe (SEND_ERROR "The guile executable was not found, but is required. Please set GUILE_EXECUTABLE.")
-ENDIF (NOT GUILE_EXECUTABLE)
+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)
+  # We also need to look up the executable
+  FIND_PROGRAM (GUILE_EXECUTABLE guile)
+  FIND_PROGRAM (GUILD_EXECUTABLE guild)
+
+  SET(GUILE_INCLUDE_DIRS ${GUILE2_INCLUDE_DIRS})
+  SET(GUILE_LDFLAGS ${GUILE2_LDFLAGS})
+
+  IF (NOT GUILE_EXECUTABLE)
+    MESSAGE (SEND_ERROR "The guile executable was not found, but is required. Please set GUILE_EXECUTABLE.")
+  ENDIF (NOT GUILE_EXECUTABLE)
+  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(GUILE_INCLUDE_DIRS ${GUILE1_INCLUDE_DIRS})
+  SET(GUILE_LDFLAGS ${GUILE1_LDFLAGS})
+  SET(HAVE_GUILE1 TRUE)
+  SET(GUILE_EFFECTIVE_VERSION 1.8)
+  MESSAGE(STATUS "Using guile-1.8.x")
+ENDIF()
+
+# 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)
+ENDIF(WITH_OFX)
+# ############################################################
+
+IF(APPLE)
+  EXECUTE_PROCESS(
+      COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=target gdk-2.0
+      OUTPUT_VARIABLE TARGET_RESULT
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+  )
+  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)
 
 # ############################################################
 
 # xsltproc
-FIND_PROGRAM (XSLTPROC xsltproc)
+FIND_PACKAGE(LibXslt)
 
+IF (NOT LIBXSLT_FOUND)
+   MESSAGE(SEND_ERROR "libxslt library not found.")
+ENDIF(NOT LIBXSLT_FOUND)
 # ############################################################
 
 # libdbi
-FIND_PATH (LIBDBI_INCLUDE_PATH dbi/dbi.h)
-FIND_LIBRARY (LIBDBI_LIBRARY dbi)
+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)
 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?")
@@ -109,40 +308,199 @@ IF (WITH_SQL)
   IF (NOT LIBDBI_LIBRARY)
     MESSAGE (SEND_ERROR "Library libdbi was not found")
   ENDIF (NOT LIBDBI_LIBRARY)
+  SET(HAVE_DBI_DBI_H 1)
 ENDIF (WITH_SQL)
 
 # ############################################################
 
-# Qt
-SET (QT_MIN_VERSION "4.5.0")
-FIND_PACKAGE (Qt4 REQUIRED) # find and setup Qt4 for this project
+FIND_PACKAGE(Perl)
 
-# ############################################################
-IF (WITH_AQBANKING)
-  PKG_CHECK_MODULES (GWENHYWFAR REQUIRED gwenhywfar)
-  PKG_CHECK_MODULES (AQBANKING REQUIRED aqbanking)
-ENDIF (WITH_AQBANKING)
+if (NOT PERL_FOUND)
+  MESSAGE(SEND_ERROR "Perl executable not found. Please set PERL_EXECUTABLE.")
+ENDIF(NOT PERL_FOUND)
+
+FIND_PROGRAM(POD2MAN_EXECUTABLE pod2man)
+
+#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
+  # that DYLD_FALLBACK_LIBRARY_PATH be set. There is supposedly a dll-path option so set RPATH, but
+  # 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)
+
+FIND_PACKAGE (Boost 1.54.0 REQUIRED COMPONENTS date_time)
+
+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)
 
-# ############################################################
 
 # Compiler flags
+
+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
+
+
 IF (UNIX)
   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")
   SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-declarations")
 ENDIF (UNIX)
 IF (MINGW)
-  SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations  -Wno-unused")
+  SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations  -Wno-unused -std=gnu99")
 ENDIF (MINGW)
-
+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()
 # ############################################################
 
 # The subdirectories
+ADD_SUBDIRECTORY (accounts)
+ADD_SUBDIRECTORY (checks)
+ADD_SUBDIRECTORY (doc)
+ADD_SUBDIRECTORY (po)
 ADD_SUBDIRECTORY (src)
 
+# 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
+    gnc-business-ledger gnc-gnome PROPERTIES
+    LIBRARY_OUTPUT_DIRECTORY         ${CMAKE_BINARY_DIR}/lib
+    IF (XCODE_VERSION)
+      LIBRARY_OUTPUT_DIRECTORY_DEBUG   ${CMAKE_BINARY_DIR}/lib
+      LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib
+    ENDIF()
+
+    RUNTIME_OUTPUT_DIRECTORY         ${CMAKE_BINARY_DIR}/bin
+    IF (XCODE_VERSION)
+      RUNTIME_OUTPUT_DIRECTORY_DEBUG   ${CMAKE_BINARY_DIR}/bin
+      RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin
+    ENDIF()
+  )
+  IF (WIN32)
+    SET_TARGET_PROPERTIES(gncmod-backend-xml gncmod-stylesheets gncmod-utility-reports PROPERTIES
+      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+    )
+  ENDIF()
+ENDIF()
+# Install DOC files from top level directory
+
+FILE(WRITE COPYING
+"This is a placeholder for the COPYING file as generated by automake.
+If and when CMake becomes the default build system, we will need to
+put COPYING under version control."
+)
+
+FILE(WRITE INSTALL
+"This is a placeholder for the INSTALL file as generated by automake.
+If and when CMake becomes the default build system, we will need to
+put INSTALL under version control."
+)
+
+SET(gnucash_DOCS
+    AUTHORS
+    ChangeLog
+    ChangeLog.2003
+    ChangeLog.2004
+    ChangeLog.2005
+    ChangeLog.2006
+    ChangeLog.2007
+    ChangeLog.2008
+    ChangeLog.2009
+    ChangeLog.2010
+    ChangeLog.2011
+    ChangeLog.2012
+    ChangeLog.2013
+    ChangeLog.2014
+    DOCUMENTERS
+    HACKING
+    LICENSE
+    NEWS
+    README.dependencies
+    COPYING
+    INSTALL
+)
+
+INSTALL(FILES ${gnucash_DOCS} DESTINATION share/doc/gnucash)
+
+#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?
+      FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+    )
+  ENDIF()
+
 
+ENDIF()
 # ############################################################
 # Package creation rules
 
+IF (WITH_CUTECASH)
+SET (CUTECASH_VERSION_MAJOR "0")
+SET (CUTECASH_VERSION_MINOR "1")
+SET (CUTECASH_VERSION_PATCH "0")
+SET (CUTECASH_VERSION_NANO "0")
+
 SET (CPACK_PACKAGE_NAME "Cutecash")
 SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cutecash Free Finance Software")
 SET (CPACK_PACKAGE_VERSION_MAJOR ${CUTECASH_VERSION_MAJOR})
@@ -152,7 +510,7 @@ 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")
-
+ENDIF (WITH_CUTECASH)
 IF(UNIX)
   SET(CPACK_GENERATOR "TGZ")
 ENDIF(UNIX)
diff --git a/accounts/CMakeLists.txt b/accounts/CMakeLists.txt
new file mode 100644
index 0000000..2899820
--- /dev/null
+++ b/accounts/CMakeLists.txt
@@ -0,0 +1,67 @@
+SET(accounts_SUBDIRS
+  C
+  cs
+  da
+  de_AT
+  de_CH
+  de_DE
+  el_GR
+  en_GB
+  es_ES
+  es_MX
+  fi_FI
+  fr_CA
+  fr_CH
+  fr_FR
+  hu_HU
+  it
+#  ja
+  ko
+  lt
+  lv
+#  nb
+#  nl
+  pl
+  pt_BR
+  pt_PT
+  ru
+  sk
+  sv_AX
+  sv_FI
+  sv_SE
+  tr_TR
+  zh_CN
+  zh_HK
+  zh_TW
+)
+
+
+# Most of the account subdirectories that have acctchrt_full.gnucash-xea do not install it. Don't know why.
+# But these subdirectories do.
+SET(accounts_fullcharts_SUBDIRS ja nb nl)
+
+FOREACH(dir ${accounts_SUBDIRS})
+  INSTALL(DIRECTORY ${dir} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/gnucash/accounts
+                           PATTERN Makefile.* EXCLUDE
+                           PATTERN acctchrt_full.gnucash-xea EXCLUDE
+                           PATTERN README.bas_2012 EXCLUDE)
+  IF (GNC_BUILD_AS_INSTALL)
+    FILE(COPY ${dir} DESTINATION ${DATADIR_BUILD}/gnucash/accounts
+      PATTERN Makefile.* EXCLUDE
+      PATTERN acctchrt_full.gnucash-xea EXCLUDE
+      PATTERN README.bas_2012 EXCLUDE
+    )
+  ENDIF()
+ENDFOREACH(dir)
+
+FOREACH(dir ${accounts_fullcharts_SUBDIRS})
+  INSTALL(DIRECTORY ${dir} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/gnucash/accounts
+      PATTERN Makefile.* EXCLUDE
+      PATTERN README.bas_2012 EXCLUDE)
+  IF (GNC_BUILD_AS_INSTALL)
+    FILE(COPY ${dir} DESTINATION ${DATADIR_BUILD}/gnucash/accounts
+      PATTERN Makefile.* EXCLUDE
+      PATTERN README.bas_2012 EXCLUDE
+    )
+  ENDIF()
+ENDFOREACH(dir)
\ No newline at end of file
diff --git a/checks/CMakeLists.txt b/checks/CMakeLists.txt
new file mode 100644
index 0000000..2663434
--- /dev/null
+++ b/checks/CMakeLists.txt
@@ -0,0 +1,15 @@
+SET(checks_DATA
+  deluxe.chk
+  liberty.chk
+  quicken.chk
+  quicken_wallet.chk
+  voucher.chk
+  quicken_check_21.chk
+  quicken_3part.chk
+)
+
+INSTALL(FILES ${checks_DATA} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/gnucash/checks)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${checks_DATA} DESTINATION ${DATADIR_BUILD}/gnucash/checks)
+ENDIF()
\ No newline at end of file
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
new file mode 100644
index 0000000..7c664c5
--- /dev/null
+++ b/cmake/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Post install actions go here.
+
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GLIB_COMPILE_SCHEMAS} ${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas)")
+
+IF (APPLE)
+  INSTALL(CODE "EXECUTE_PROCESS(
+                COMMAND /usr/bin/install_name_tool -add_rpath ${CMAKE_INSTALL_PREFIX}/lib
+                                                   -add_rpath ${CMAKE_INSTALL_PREFIX}/lib/gnucash
+                                                   ${CMAKE_INSTALL_PREFIX}/bin/gnucash)")
+ENDIF(APPLE)
+
+
+IF (GNC_BUILD_AS_INSTALL)
+  SET(schema-targets aqb-gschema business-gnome-gschema csv-exp-gschema csv-imp-gschema
+      generic-import-gschema gnome-gschema gnome-utils-gschema ofx-gschema qif-imp-gschema)
+
+  SET(SCHEMA_DIRECTORY ${DATADIR_BUILD}/glib-2.0/schemas)
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${SCHEMA_DIRECTORY}/gschemas.compiled
+    COMMAND ${CMAKE_COMMAND} -E env ${GLIB_COMPILE_SCHEMAS} ${SCHEMA_DIRECTORY}
+    DEPENDS ${schema-targets}
+  )
+
+  ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_DIRECTORY}/gschemas.compiled)
+
+ENDIF(GNC_BUILD_AS_INSTALL)
\ No newline at end of file
diff --git a/cmake/README_CMAKE.txt b/cmake/README_CMAKE.txt
new file mode 100644
index 0000000..439a048
--- /dev/null
+++ b/cmake/README_CMAKE.txt
@@ -0,0 +1,218 @@
+Using CMake to build GnuCash
+============================
+
+== Intro
+
+As part of his CuteCash work, Christian Stimming added support for
+using http://www.cmake.org[CMake] to build the part of GnuCash that
+went into CuteCash. This work extends the use of CMake to cover all of
+GnuCash proper such that GnuCash itself can be fully compiled with
+CMake.
+
+Some advantages of using CMake:
+
+ * The build time on Windows drops from around an hour to just a few
+   minutes.
+   
+ * CMake supports the generation of build files for several IDEs
+   such as Xcode, Eclipse, KDevelop and others. The open source Qt
+   Creator and the commercial CLion C/C++ IDE from JetBrains can use
+   CMake files natively.
+
+ * The CMake language, though with significant issues, is still
+   easier to maintain than autotools.
+
+This setup also uses the http://www.ninja-build.org[Ninja] build
+system to enable fast and parallel builds on Windows. (On POSIX
+systems [OS X, Linux, FreeBSD, etc.] Ninja does not seem significantly
+faster that using the default Makefile generator to me.)
+
+== Scope
+
+The scope of the current work is to duplicate the `make` and `make
+install` actions as the Autotools system would. Currently, there is no
+support for `make check`, `make dist`, `make distcheck` or similar
+targets. Other limitations include:
+
+  * Not all options available in `./configure` have been ported to
+    this CMake system.
+
+  * Password management is included for OS X, but not
+    tested. Gnome-keyring and libsecret support has not
+    been ported over.
+
+  * The Xcode build only supports the Debug configuration. Others such
+    as Release are not supported yet.
+
+  * Python support has not been ported over.
+
+  * Visual Studio support is out of scope. While CMake supports
+    generating build files for Visual Studio on Windows, it is not
+    likely at this point that either GnuCash or all of its
+    dependencies can be built using the Microsoft compiler tool chain.
+
+== Known Issues
+
+* Sometimes the Tip of the Day is empty. I've got a stray
+  carriage return somewhere.
+
+* Clicking on 'Start AqBanking Wizard' in the AqBanking setup will
+  cause a crash. I have not yet investigated this.
+
+== Using CMake on Linux, OS X,  etc.
+
+=== Prerequisites
+
+The CMake setup does not support building and installing dependencies
+(although it probably could some day). So you need to have the
+dependencies available, most likely by having run the existing
+Autotools build at least once. Various resources on the GnuCash wiki
+will have advice on how to do this.
+
+You will need to have CMake and optionally Ninja installed, either
+from distro package repositories or by hand. You need at least version
+3.1 of CMake.
+
+=== Running CMake
+
+The next step is to invoke CMake to generate the build system. Before
+running CMake, you need to create a build directory:
+
+  $ cd ..   # back to workdir
+  $ mkdir gnucash-build
+  $ cd gnucash-build
+
+Then decide what cmake command line options you will need:
+
+ * If you want to install after building, add
+   `-D CMAKE_INSTALL_PREFIX=/path/to/install`
+
+ * If your dependencies are installed in a non-standard place as is
+   typical for building on OS X, put
+   `-D CMAKE_PREFIX_PATH=/path/to/installed/depends`
+   on the command line.
+
+ * If you want to use the Ninja generator, put `-G Ninja` on the
+   command line.
+
+ * If you want to use the Xcode generator on OS X, put `-G Xcode` on
+   the command line.
+
+ * If you don't specify a generator, Makefiles will be generated.
+
+ * Finally, put the path to your source directory last.
+   Here, that is ../gnucash
+
+ * There are other options available; look in the `OPTIONS` section of
+   the top-level `CMakeLists.txt` file.  For example, you can disable
+   SQL using these options.
+
+Some examples:
+
+ * Build on Linux, don't want to install, use the Makefile generator:
+
+   $ cmake ../gnucash
+
+ * Build on Linux, install to /tmp/gnucash, use Ninja generator:
+
+   $ cmake -D CMAKE_INSTALL_PREFIX=/tmp/gnucash -G Ninja ../gnucash
+
+ * Build on OS X, install to /tmp/gnucash, use Ninja generator:
+
+   $ cmake -D CMAKE_INSTALL_PREFIX=/tmp/gnucash -D CMAKE_PREFIX_PATH=$HOME/gnucash-unstable -G Ninja ../gnucash
+
+ * The same, but use the Xcode generator:
+
+   $ cmake -D CMAKE_INSTALL_PREFIX=/tmp/gnucash -D CMAKE_PREFIX_PATH=$HOME/gnucash-unstable -G Xcode ../gnucash
+
+=== Building
+
+The Xcode, Ninja and Makefile generators all support parallel builds,
+so decide how many cores you want to use.  Ninja will pick a sensible
+default.
+
+If you chose to configure for installation, you can use the `install`
+target for each generator. The Makefile and Ninja generators also
+support a verbose option if you want to see all of the command lines
+scroll by. Xcodebuild seems to show all the gory details whether you
+want them or not.
+
+For Ninja, use the line below. Note that the executable is called
+`ninja-build` on Fedora. Also, Ninja supports the `NINJA_STATUS`
+environment variable to give status on the build. I like to use
+`NINJA_STATUS="%es [%p/%s/%t] "`.
+
+   $ ninja [-v] [install]
+
+For Makefiles:
+
+   $ make [VERBOSE=1] -j N [install]
+
+For Xcode via the command line (see below to build from within Xcode):
+
+   $ xcodebuild -jobs N [-target=install]
+
+=== Launching GnuCash
+
+Assuming the build completes successfully, in all cases you can run
+directly from the build directory:
+
+   $ bin/gnucash
+
+In you chose to install, you can switch to the install directory and
+do the same.
+
+
+== Using CMake and Ninja on Windows
+
+
+For Windows, follow the instructions at
+https://github.com/Gnucash/gnucash-on-windows to the point where you
+are ready to run install.sh.
+
+Edit custom.sh to add these lines at the bottom:
+
+  WITH_CMAKE=yes
+  WITH_NINJA=yes
+
+Ensure that your custom.sh file contains this line:
+
+  MSYS_DIR=c:\\gcdev\\mingw\\msys\\1.0
+
+Remove or move any existing install at /c/gcdev/gnucash/inst.
+
+Then continue to follow the existing build instructions.
+
+At this writing, generating a distribution with the CMake build
+via dist.sh has not been tested.
+
+
+== Using Xcode on OS X
+
+CMake can generate build files for Xcode such that GnuCash can be
+built, run and debugged from within Xcode.  Follow the instructions
+above to the point where you would use `xcodebuild` to launch the
+build. Instead, launch Xcode by doing:
+
+  $ open Gnucash.xcodeproj
+
+Xcode 7 will pop up a window about Autocreate Schemes. I usually
+choose "Manually Manage Schemes". On the next window, use the "\+"
+symbol to use the "ALL_BUILD" scheme. Then click on OK. If you want to
+be able to run the equivalent of "make install" from within Xcode, use
+the "+" symbol again and choose the "install" scheme.
+
+Back in the Xcode main window, make sure the "ALL_BUILD" scheme is
+selected (next to the stop symbol).  Click on "ALL_BUILD" and
+then "Edit Scheme". On the "Info" tab, choose the executable to be
+"gnucash".
+
+Now use Command-B to build (or Product -> Build) to start the
+build. When it finishes, click on the play symbol (or Product
+-> Run) to verify that you can launch GnuCash from within Xcode. If
+that works, you can now set breakpoints with Xcode and debug away.
+
+To run the install script, click on the "ALL_BUILD" scheme and change
+it to "install". Then press the play button to run the script.
+
+That's it.
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 0000000..6c532c3
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,72 @@
+ADD_SUBDIRECTORY(examples)
+
+SET(doc_DATA
+  README.francais
+  README.german
+  README-de.win32-bin.txt
+  README-fr.win32-bin.txt
+  README-it.win32-bin.txt
+  README-lv.win32-bin.txt
+  README-nl.win32-bin.txt
+  README-zh_CN.win32-bin.txt
+  README-zh_TW.win32-bin.txt
+  README.win32-bin.txt
+  guile-hackers.txt
+  projects.html
+)
+
+INSTALL(FILES ${doc_DATA} DESTINATION share/doc/gnucash)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${doc_DATA} DESTINATION ${DATADIR_BUILD}/doc/gnucash)
+ENDIF()
+
+EXECUTE_PROCESS(
+    COMMAND ${CMAKE_COMMAND} -E  env date +"%B %Y"
+    OUTPUT_VARIABLE DATE
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# Generate the tip of the day file.
+
+EXECUTE_PROCESS(
+    COMMAND ${CMAKE_C_COMPILER} -E -P -x c -DN_\(x\)=x -o ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list.tmp ${CMAKE_CURRENT_SOURCE_DIR}/tip_of_the_day.list.in
+)
+
+FILE(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list.tmp TIP_OF_THE_DAY_LINES)
+
+SET(TOTD_OUTPUT "")
+SET(FIRST_LINE TRUE)
+FOREACH(line ${TIP_OF_THE_DAY_LINES})
+  STRING(REGEX REPLACE "^ *\"" "" line2 "${line}")
+  STRING(REGEX REPLACE "\" *$" "" line3 "${line2}")
+  IF (NOT FIRST_LINE)
+    LIST(APPEND TOTD_OUTPUT "\n\n")
+  ENDIF()
+  SET(FIRST_LINE FALSE)
+  LIST(APPEND TOTD_OUTPUT "${line3}\n")
+ENDFOREACH()
+
+LIST(APPEND TOTD_OUTPUT "\n")
+
+STRING(CONCAT FINAL_TOTD ${TOTD_OUTPUT})
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list "${FINAL_TOTD}")
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list DESTINATION share/gnucash)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list
+    DESTINATION ${DATADIR_BUILD}/gnucash)
+ENDIF()
+
+# ---
+
+GNC_CONFIGURE(gnucash.1.in gnucash.1 )
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.1 DESTINATION share/man/man1)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/gnucash.1
+    DESTINATION ${DATADIR_BUILD}/gnucash)
+ENDIF()
+
diff --git a/doc/examples/CMakeLists.txt b/doc/examples/CMakeLists.txt
new file mode 100644
index 0000000..efd5bd7
--- /dev/null
+++ b/doc/examples/CMakeLists.txt
@@ -0,0 +1,24 @@
+
+
+SET(examples_DATA
+  Money95bank_fr.qif
+  Money95invst_fr.qif
+  Money95mfunds_fr.qif
+  Money95stocks_fr.qif
+  README
+  README_invoice
+  abc-all.qif
+  abc.qif
+  bogus.qif
+  cbb-export.qif
+  currency_tree_xml.gnucash
+  every.qif
+  invoice.csv
+  ms-money.qif
+  quicktest.qif
+  swipe.qif
+  taxreport.gnucash
+  web.qif
+)
+
+INSTALL(FILES ${examples_DATA} DESTINATION share/doc/gnucash)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 0000000..ba7728f
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,48 @@
+
+
+# Set of available languages.
+SET (TP_LINGUAS az ca cs da eu fa ja nl pt rw sk sr sv tr uk zh_CN)
+# already marked as external at TP:
+SET (GC_LINGUAS ar bg de el en_GB es fi fr gu he hi hu it kn ko lt lv mr nb ne pl pt_BR ro ru ta te ur vi zh_TW)
+# not marked or no TP team:
+SET (NEW_LINGUAS as brx doi es_NI kok kok at latin ks mai mni mni at bengali)
+
+SET (ALL_LINGUAS ${TP_LINGUAS} ${GC_LINGUAS} ${NEW_LINGUAS})
+
+SET (CATALOGS "")
+SET (BUILD_CATALOGS "")
+FOREACH(lingua ${ALL_LINGUAS})
+  SET(_OUTPUT_FILE ${lingua}.gmo)
+  LIST(APPEND CATALOGS ${_OUTPUT_FILE})
+  ADD_CUSTOM_COMMAND(
+      OUTPUT ${_OUTPUT_FILE}
+      COMMAND ${CMAKE_COMMAND} -E env ${MSGFMT} -o ${_OUTPUT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${lingua}.po
+  )
+  IF (GNC_BUILD_AS_INSTALL)
+    SET(_BUILD_FILE_DIR ${DATADIR_BUILD}/locale/${lingua}/LC_MESSAGES)
+    MAKE_DIRECTORY(${_BUILD_FILE_DIR})
+    SET(_BUILD_FILE ${_BUILD_FILE_DIR}/gnucash.gmo)
+    LIST(APPEND BUILD_CATALOGS ${_BUILD_FILE})
+    #ADD_CUSTOM_COMMAND(
+    #  OUTPUT ${_BUILD_FILE}
+    #  COMMAND ${CMAKE_COMMAND} make_directory ${_BUILD_FILE_DIR}
+    #
+    #)
+    ADD_CUSTOM_COMMAND(
+      OUTPUT ${_BUILD_FILE}
+      COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${lingua}.gmo ${_BUILD_FILE}
+      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_OUTPUT_FILE}
+      #APPEND
+    )
+  ENDIF()
+ENDFOREACH(lingua)
+
+ADD_CUSTOM_TARGET(po-gmo ALL DEPENDS ${CATALOGS})
+IF (GNC_BUILD_AS_INSTALL)
+  ADD_CUSTOM_TARGET(po-gmo-build ALL DEPENDS ${BUILD_CATALOGS})
+ENDIF()
+
+
+FOREACH(lingua ${ALL_LINGUAS})
+  INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lingua}.gmo RENAME gnucash.mo DESTINATION share/locale/${lingua}/LC_MESSAGES)
+ENDFOREACH(lingua)
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 007b12d..3b67f3b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,6 +6,8 @@
 
 SET (GETTEXT_PACKAGE "gnucash")
 
+SET(GNOME 1)
+
 IF (WIN32)
   SET (HAVE_SCANF_I64D 1)
   SET (HAVE_HTMLHELPW 1)
@@ -36,6 +38,20 @@ 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)
+SET(ENABLE_NLS 1)
+ENDIF(NOT DISABLE_NLS)
+
+IF (ENABLE_DEBUG)
+  SET(DEBUG_MEMORY 1)
+ENDIF(ENABLE_DEBUG)
+
+IF (ENABLE_BINRELOC)
+  IF (UNIX OR MINGW)
+    SET(BR_PTHREAD 1)
+  ENDIF(UNIX OR MINGW)
+ENDIF(ENABLE_BINRELOC)
+
 IF (UNIX OR MINGW)
   SET (HAVE_BIND_TEXTDOMAIN_CODESET 1)
   SET (HAVE_DCGETTEXT 1)
@@ -50,12 +66,12 @@ IF (UNIX OR MINGW)
   SET (_POSIX_PTHREAD_SEMANTICS 1)
   SET (_TANDEM_SOURCE 1)
   SET (__EXTENSIONS__ 1)
-  SET (WORDS_BIGENDIAN 1)
 ENDIF (UNIX OR MINGW)
 
 IF (UNIX)
   SET (HAVE_CHOWN 1)
   SET (HAVE_DLERROR 1)
+  SET (HAVE_DLSYM 1)
   SET (HAVE_GETHOSTID 1)
   SET (HAVE_GETHOSTNAME 1)
   SET (HAVE_GETPPID 1)
@@ -67,14 +83,59 @@ IF (UNIX)
   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)
 ENDIF (UNIX)
 
+IF (WIN32)
+  SET (GNC_PLATFORM_WINDOWS 1)
+ENDIF (WIN32)
+
+IF (APPLE)
+  # FIXME: HANDLE gtk-mac-integration-gtk2
+  SET(GNC_PLATFORM_DARWIN 1)
+  SET(GNC_PLATFORM_OSX 1)
+  SET(HAVE_OSX_KEYCHAIN 1)
+
+ENDIF(APPLE)
+
+IF(GLIB2_VERSION VERSION_GREATER 2.32.0 OR GLIB2_VERSION VERSION_EQUAL 2.32.0)
+  SET(HAVE_GLIB_2_32 1)
+ENDIF()
+
+IF(GLIB2_VERSION VERSION_GREATER 2.36.0 OR GLIB2_VERSION VERSION_EQUAL 2.36.0)
+  SET(HAVE_GLIB_2_36 1)
+ENDIF()
+
+IF(GLIB2_VERSION VERSION_GREATER 2.38.0 OR GLIB2_VERSION VERSION_EQUAL 2.38.0)
+  SET(HAVE_GLIB_2_38 1)
+ENDIF()
+
+SET(HAVE_WEBKIT_WEB_FRAME_PRINT_FULL 1)
+SET(HAVE_WEBKIT_WEB_VIEW_LOAD_URI 1)
+
+IF(DISABLE_DEPRECATED_GNOME)
+  SET(GNOME_DISABLE_DEPRECATED 1)
+ENDIF(DISABLE_DEPRECATED_GNOME)
+
+IF(DISABLE_DEPRECATED_GTK)
+  SET(GTK_DISABLE_DEPRECATED 1)
+  SET(GDK_DISABLE_DEPRECATED 1)
+  SET(GDK_PIXMAP_DISABLE_DEPRECATED 1)
+ENDIF(DISABLE_DEPRECATED_GTK)
+
+IF(DISABLE_DEPRECATED_GLIB)
+  SET(G_DISABLE_DEPRECATED 1)
+ENDIF(DISABLE_DEPRECATED_GLIB)
+
 ADD_DEFINITIONS (-DHAVE_CONFIG_H)
 
 SET (CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/config.h)
@@ -82,8 +143,16 @@ CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in ${CONFIG_H})
 
 SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_BINARY_DIR}/swig-runtime.h)
 
+#ADD_CUSTOM_COMMAND (
+#  OUTPUT ${SWIG_RUNTIME_H}
+#  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
+#  COMMAND ${SWIG_EXECUTABLE} -guile -external-runtime ${SWIG_RUNTIME_H}
+#)
 # ############################################################
 
+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})
+
 # The subdirectories
 ADD_SUBDIRECTORY (libqof)
 ADD_SUBDIRECTORY (core-utils)
@@ -96,7 +165,30 @@ IF (WITH_SQL)
   ADD_SUBDIRECTORY (backend/dbi)
   ADD_SUBDIRECTORY (backend/sql)
 ENDIF (WITH_SQL)
-ADD_SUBDIRECTORY (optional/gtkmm)
 
-ADD_SUBDIRECTORY (gnc)
+IF (WITH_GNUCASH)
+  ADD_SUBDIRECTORY (bin)
+  ADD_SUBDIRECTORY (business/business-ledger)
+  ADD_SUBDIRECTORY (business/business-gnome)
+  ADD_SUBDIRECTORY (gnome)
+  ADD_SUBDIRECTORY (gnome-utils)
+  ADD_SUBDIRECTORY (gnome-search)
+  ADD_SUBDIRECTORY (html)
+  ADD_SUBDIRECTORY (plugins/bi_import)
+  ADD_SUBDIRECTORY (plugins/customer_import)
+  ADD_SUBDIRECTORY (pixmaps)
+  ADD_SUBDIRECTORY (quotes)
+  ADD_SUBDIRECTORY (register/ledger-core)
+  ADD_SUBDIRECTORY (register/register-core)
+  ADD_SUBDIRECTORY (register/register-gnome)
+  ADD_SUBDIRECTORY(report)
+  ADD_SUBDIRECTORY (scm)
+  ADD_SUBDIRECTORY (tax/us)
+  ADD_SUBDIRECTORY (test-core)
+ENDIF (WITH_GNUCASH)
+
+IF (WITH_CUTECASH)
+  ADD_SUBDIRECTORY (optional/gtkmm)
+  ADD_SUBDIRECTORY (gnc)
+ENDIF (WITH_CUTECASH)
 
diff --git a/src/app-utils/CMakeLists.txt b/src/app-utils/CMakeLists.txt
index 71f68577..dd4f97a 100644
--- a/src/app-utils/CMakeLists.txt
+++ b/src/app-utils/CMakeLists.txt
@@ -1,26 +1,17 @@
-# CMakeLists.txt for src/engine
-
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.app-utils\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GCONF2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${HTMLHELP_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for pow.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof) # for qof.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/app-utils/calculation) # for finproto.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine) # for gnc-engine.h
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src/engine) # for swig-runtime.h
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # for <option-util.h>
+
+# Build the library
+
+SET (app_utils_noinst_HEADERS
+  calculation/finvar.h
+  calculation/finproto.h
+  calculation/fin_spl_protos.h
+  calculation/fin_static_proto.h
+)
 
 SET (app_utils_HEADERS
   QuickFill.h
+  business-helpers.h
+  business-options.h
   file-utils.h
   gfec.h
   gnc-basic-gobject.h
@@ -32,17 +23,17 @@ SET (app_utils_HEADERS
   gnc-euro.h
   gnc-exp-parser.h
   gnc-gettext-util.h
+  gnc-gsettings.h
   gnc-help-utils.h
   gnc-helpers.h
+  gnc-prefs-utils.h
+  gnc-state.h  
   gnc-sx-instance-model.h
   gnc-ui-util.h
   gnc-ui-balances.h
   guile-util.h
   option-util.h
-  calculation/finvar.h
-  calculation/finproto.h
-  calculation/fin_spl_protos.h
-  calculation/fin_static_proto.h
+
 )
 
 # Command to generate the swig-app-utils.c wrapper file
@@ -52,6 +43,8 @@ GNC_ADD_SWIG_COMMAND (${SWIG_APP_UTILS_C} ${CMAKE_CURRENT_SOURCE_DIR}/app-utils.
 SET (app_utils_SOURCES
   calculation/expression_parser.c
   calculation/fin.c
+  business-helpers.c
+  business-options.c
   QuickFill.c
   file-utils.c
   gfec.c
@@ -63,8 +56,11 @@ SET (app_utils_SOURCES
   gnc-euro.c
   gnc-exp-parser.c
   gnc-gettext-util.c
+  gnc-gsettings.c
   gnc-helpers.c
+  gnc-prefs-utils.c
   gnc-sx-instance-model.c
+  gnc-state.c
   gnc-ui-util.c
   gnc-ui-balances.c
   gncmod-app-utils.c
@@ -77,7 +73,121 @@ IF (WIN32)
   SET (app_utils_SOURCES ${app_utils_SOURCES} gnc-help-utils.c)
 ENDIF (WIN32)
 
-ADD_LIBRARY	(app-utils
+SET_SOURCE_FILES_PROPERTIES (${app_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY	(gncmod-app-utils
   ${app_utils_SOURCES}
   ${app_utils_HEADERS}
-  )
+  ${app_utils_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-app-utils gncmod-engine gnc-module 
+  ${GTK2_LDFLAGS} ${LIBXML2_LDFLAGS} ${LIBXSLT_LDFLAGS}
+)
+
+IF (WIN32) 
+   TARGET_LINK_LIBRARIES(gncmod-app-utils ${HTMLHELP_LIBRARY})
+ENDIF(WIN32)
+
+TARGET_INCLUDE_DIRECTORIES (gncmod-app-utils
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE
+      ${CMAKE_CURRENT_SOURCE_DIR}/calculation
+      ${LIBXML2_INCLUDE_DIRS}
+      ${LIBXSLT_INCLUDE_DIRS}
+      ${HTMLHELP_INCLUDE_PATH}
+      ${GTK2_INCLUDE_DIRS}
+)
+
+TARGET_COMPILE_DEFINITIONS (gncmod-app-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
+
+
+INSTALL(TARGETS gncmod-app-utils
+     LIBRARY DESTINATION lib/gnucash
+     ARCHIVE DESTINATION lib/gnucash
+     RUNTIME DESTINATION bin
+)
+INSTALL(FILES ${app_utils_HEADERS} DESTINATION include/gnucash)
+
+FILE(READ ${CMAKE_SOURCE_DIR}/src/import-export/ofx/migratable-prefs-ofx.xml MIGRATABLE_PREFS_OFX)
+FILE(READ ${CMAKE_SOURCE_DIR}/src/import-export/aqb/migratable-prefs-aqbanking.xml MIGRATABLE_PREFS_AQBANKING)
+
+SET(MIGRATABLE_PREFS_XML ${CMAKE_CURRENT_BINARY_DIR}/migratable-prefs.xml)
+IF (GNC_BUILD_AS_INSTALL)
+  SET(MIGRATABLE_PREFS_XML ${DATADIR_BUILD}/gnucash/migratable-prefs.xml)
+  FILE(COPY make-prefs-migration-script.xsl DESTINATION ${DATADIR_BUILD}/gnucash)
+ENDIF()
+
+CONFIGURE_FILE(migratable-prefs.xml.in ${MIGRATABLE_PREFS_XML})
+
+INSTALL(FILES ${MIGRATABLE_PREFS_XML} DESTINATION share/gnucash)
+INSTALL(FILES make-prefs-migration-script.xsl DESTINATION share/gnucash)
+
+# And now handle scheme files
+
+SET (app_utils_SCHEME_2
+    app-utils.scm
+)
+
+SET (app_utils_SCHEME_1
+    hooks.scm
+    business-options.scm
+    c-interface.scm
+    config-var.scm
+    date-utilities.scm
+    migrate-prefs.scm
+    options.scm
+    prefs.scm
+    simple-obj.scm
+)
+
+SET(app_utils_SCHEME_3
+    business-prefs.scm
+)
+
+SET(GUILE_MODULES      src/engine)
+SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/scm)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/libqof/qof)
+SET(GUILE_DEPENDS      gncmod-app-utils scm-core-utils scm-engine scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-gettext
+  gettext.scm
+  gnucash
+  src/app-utils
+  ""
+  ""
+  gncmod-app-utils
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-app-utils-1
+  "${app_utils_SCHEME_1}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-gettext;${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-app-utils-2
+  "${app_utils_SCHEME_2}"
+  "gnucash"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-app-utils-1
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-app-utils-3
+  "${app_utils_SCHEME_3}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-app-utils-2
+  FALSE
+)
+
+ADD_CUSTOM_TARGET(scm-app-utils ALL DEPENDS scm-app-utils-3 scm-app-utils-2 scm-app-utils-1 scm-gettext)
\ No newline at end of file
diff --git a/src/backend/dbi/CMakeLists.txt b/src/backend/dbi/CMakeLists.txt
index fcfc05c..8e96b81 100644
--- a/src/backend/dbi/CMakeLists.txt
+++ b/src/backend/dbi/CMakeLists.txt
@@ -1,32 +1,47 @@
 # CMakeLists.txt for src/backend/dbi
 
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.backend.dbi\")
-
-INCLUDE_DIRECTORIES (${GCONF2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${LIBDBI_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/app-utils)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/backend/sql)
-
-SET (libgnc_backend_dbi_SOURCES
-  gnc-backend-dbi.c
+# Source file gncmod-backend-dbi.c does not appear to be use in Makefile.in, so not included here.
+
+SET (backend_dbi_SOURCES
+  gnc-backend-dbi.cpp
 )
-SET (libgnc_backend_dbi_HEADERS
-  gnc-backend-dbi.h
+SET (backend_dbi_noinst_HEADERS
+  gnc-backend-dbi.h gnc-backend-dbi-priv.h
 )
 
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_backend_dbi_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${backend_dbi_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY	(gncmod-backend-dbi
+  ${backend_dbi_SOURCES}
+  ${backend_dbi_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-backend-dbi gnc-backend-sql gncmod-engine gnc-qof ${GTK2_LDFLAGS} ${LIBDBI_LIBRARY})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-backend-dbi PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.dbi\")
 
-ADD_LIBRARY	(gnc-backend-dbi
-  ${libgnc_backend_dbi_SOURCES}
-  ${libgnc_backend_dbi_HEADERS}
+TARGET_INCLUDE_DIRECTORIES(gncmod-backend-dbi PRIVATE ${LIBDBI_INCLUDE_PATH})
+
+INSTALL(TARGETS gncmod-backend-dbi
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# FIXME: Below is a hack to create .libs/libgncmod-backend-dbi to silence some complaints
+# from guile when compiling. Eventually, fix the guile module loader to not expect items
+# to be in .libs. At this time, WIN32 does not use guile-2, so no need for this.
+
+IF (NOT WIN32)
+  SET(_LINK_TARGET ${CMAKE_CURRENT_BINARY_DIR}/.libs/libgncmod-backend-dbi${CMAKE_SHARED_LIBRARY_SUFFIX})
+  FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.libs)
+
+  ADD_CUSTOM_COMMAND(
+      OUTPUT ${_LINK_TARGET}
+      COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:gncmod-backend-dbi> ${_LINK_TARGET}
+      DEPENDS gnc-backend-dbi
   )
+
+  ADD_CUSTOM_TARGET(gncmod-backend-dbi-link ALL DEPENDS gncmod-backend-dbi ${_LINK_TARGET})
+ENDIF()
diff --git a/src/backend/sql/CMakeLists.txt b/src/backend/sql/CMakeLists.txt
index 3f463a6..4da6bfa 100644
--- a/src/backend/sql/CMakeLists.txt
+++ b/src/backend/sql/CMakeLists.txt
@@ -1,46 +1,33 @@
 # CMakeLists.txt for src/backend/dbi
 
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.backend.sql\")
 
-INCLUDE_DIRECTORIES (${GCONF2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine)
 
-SET (libgnc_backend_sql_SOURCES
-  gnc-backend-sql.c
-  gnc-account-sql.c
-  gnc-address-sql.c
-  gnc-bill-term-sql.c
-  gnc-book-sql.c
-  gnc-budget-sql.c
-  gnc-commodity-sql.c
-  gnc-customer-sql.c
-  gnc-employee-sql.c
-  gnc-entry-sql.c
-  gnc-invoice-sql.c
-  gnc-job-sql.c
-  gnc-lots-sql.c
-  gnc-order-sql.c
-  gnc-owner-sql.c
-  gnc-price-sql.c
-  gnc-recurrence-sql.c
-  gnc-schedxaction-sql.c
-  gnc-slots-sql.c
-  gnc-tax-table-sql.c
-  gnc-transaction-sql.c
-  gnc-vendor-sql.c
-  escape.c
+SET (backend_sql_SOURCES
+  gnc-backend-sql.cpp
+  gnc-account-sql.cpp
+  gnc-address-sql.cpp
+  gnc-bill-term-sql.cpp
+  gnc-book-sql.cpp
+  gnc-budget-sql.cpp
+  gnc-commodity-sql.cpp
+  gnc-customer-sql.cpp
+  gnc-employee-sql.cpp
+  gnc-entry-sql.cpp
+  gnc-invoice-sql.cpp
+  gnc-job-sql.cpp
+  gnc-lots-sql.cpp
+  gnc-order-sql.cpp
+  gnc-owner-sql.cpp
+  gnc-price-sql.cpp
+  gnc-recurrence-sql.cpp
+  gnc-schedxaction-sql.cpp
+  gnc-slots-sql.cpp
+  gnc-tax-table-sql.cpp
+  gnc-transaction-sql.cpp
+  gnc-vendor-sql.cpp
+  escape.cpp
 )
-SET (libgnc_backend_sql_HEADERS
+SET (backend_sql_noinst_HEADERS
   gnc-account-sql.h
   gnc-address-sql.h
   gnc-backend-sql.h
@@ -67,9 +54,22 @@ SET (libgnc_backend_sql_HEADERS
 )
 
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_backend_sql_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${gnc_backend_sql_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
 ADD_LIBRARY	(gnc-backend-sql
-  ${libgnc_backend_sql_SOURCES}
-  ${libgnc_backend_sql_HEADERS}
-  )
+  ${backend_sql_SOURCES}
+  ${backend_sql_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gnc-backend-sql gncmod-engine gnc-qof)
+
+TARGET_COMPILE_DEFINITIONS (gnc-backend-sql PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.sql\")
+
+TARGET_INCLUDE_DIRECTORIES(gnc-backend-sql PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gnc-backend-sql
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+
+# No headers to install
diff --git a/src/backend/xml/CMakeLists.txt b/src/backend/xml/CMakeLists.txt
index fec23e2..99fd698 100644
--- a/src/backend/xml/CMakeLists.txt
+++ b/src/backend/xml/CMakeLists.txt
@@ -1,66 +1,136 @@
 # CMakeLists.txt for src/backend/xml
 
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.backend.xml\")
-
-INCLUDE_DIRECTORIES (${GCONF2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${LIBXML2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine)
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # when building swig-gnc-module.c
-
 # Command to generate the swig-engine.c wrapper file
 SET (SWIG_GNC_MODULE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnc-module.c)
 GNC_ADD_SWIG_COMMAND (${SWIG_GNC_MODULE_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnc-module.i)
 
-SET (libgnc_backend_xml_SOURCES
-  gnc-account-xml-v2.c 
-  gnc-address-xml-v2.c
-  gnc-bill-term-xml-v2.c
-  gnc-book-xml-v2.c 
-  gnc-budget-xml-v2.c 
-  gnc-commodity-xml-v2.c 
-  gnc-customer-xml-v2.c
-  gnc-employee-xml-v2.c
-  gnc-entry-xml-v2.c
-  gnc-freqspec-xml-v2.c 
-  gnc-invoice-xml-v2.c
-  gnc-job-xml-v2.c
-  gnc-lot-xml-v2.c 
-  gnc-order-xml-v2.c
-  gnc-owner-xml-v2.c
-  gnc-pricedb-xml-v2.c 
-  gnc-recurrence-xml-v2.c 
-  gnc-schedxaction-xml-v2.c 
-  gnc-tax-table-xml-v2.c
-  gnc-transaction-xml-v2.c 
-  gnc-vendor-xml-v2.c
-  gnc-xml-helper.c
-  io-example-account.c 
-  io-gncxml-gen.c 
-  io-gncxml-v1.c 
-  io-gncxml-v2.c 
-  io-utils.c 
-  sixtp-dom-generators.c 
-  sixtp-dom-parsers.c 
-  sixtp-stack.c 
-  sixtp-to-dom-parser.c 
-  sixtp-utils.c 
-  sixtp.c
-  gnc-backend-xml.c
+SET (backend_xml_utils_noinst_HEADERS
+  gnc-backend-xml.h
+  gnc-xml.h
+  gnc-address-xml-v2.h
+  gnc-bill-term-xml-v2.h
+  gnc-customer-xml-v2.h
+  gnc-employee-xml-v2.h
+  gnc-entry-xml-v2.h
+  gnc-invoice-xml-v2.h
+  gnc-job-xml-v2.h
+  gnc-order-xml-v2.h
+  gnc-owner-xml-v2.h
+  gnc-tax-table-xml-v2.h
+  gnc-vendor-xml-v2.h
+  gnc-xml-helper.h
+  io-example-account.h
+  io-gncxml-gen.h
+  io-gncxml-v2.h
+  io-gncxml.h
+  io-utils.h
+  sixtp-dom-generators.h
+  sixtp-dom-parsers.h
+  sixtp-parsers.h
+  sixtp-stack.h
+  sixtp-utils.h
+  sixtp.h
+  xml-helpers.h
+)
+
+SET (backend_xml_utils_SOURCES
+  gnc-account-xml-v2.cpp
+  gnc-address-xml-v2.cpp
+  gnc-bill-term-xml-v2.cpp
+  gnc-book-xml-v2.cpp
+  gnc-budget-xml-v2.cpp
+  gnc-commodity-xml-v2.cpp
+  gnc-customer-xml-v2.cpp
+  gnc-employee-xml-v2.cpp
+  gnc-entry-xml-v2.cpp
+  gnc-freqspec-xml-v2.cpp
+  gnc-invoice-xml-v2.cpp
+  gnc-job-xml-v2.cpp
+  gnc-lot-xml-v2.cpp
+  gnc-order-xml-v2.cpp
+  gnc-owner-xml-v2.cpp
+  gnc-pricedb-xml-v2.cpp
+  gnc-recurrence-xml-v2.cpp
+  gnc-schedxaction-xml-v2.cpp
+  gnc-tax-table-xml-v2.cpp
+  gnc-transaction-xml-v2.cpp
+  gnc-vendor-xml-v2.cpp
+  gnc-xml-helper.cpp
+  io-example-account.cpp
+  io-gncxml-gen.cpp
+  io-gncxml-v1.cpp
+  io-gncxml-v2.cpp
+  io-utils.cpp
+  sixtp-dom-generators.cpp
+  sixtp-dom-parsers.cpp
+  sixtp-stack.cpp
+  sixtp-to-dom-parser.cpp
+  sixtp-utils.cpp
+  sixtp.cpp
 )
 
+
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_backend_xml_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${backend_xml_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY	(gnc-backend-xml-utils
+  ${backend_xml_utils_SOURCES}
+  ${backend_xml_utils_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gnc-backend-xml-utils gncmod-engine ${LIBXML2_LDFLAGS} ${ZLIB_LDFLAGS})
+
+TARGET_INCLUDE_DIRECTORIES (gnc-backend-xml-utils
+  PUBLIC  ${LIBXML2_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${ZLIB_INCLUDE_DIRS}
+)
+
+TARGET_COMPILE_DEFINITIONS (gnc-backend-xml-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\")
+
+INSTALL(TARGETS gnc-backend-xml-utils
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# ----
 
-ADD_LIBRARY	(gnc-backend-xml
-  ${libgnc_backend_xml_SOURCES}
+SET(libgncmod_backend_xml_SOURCES gnc-backend-xml.cpp)
+
+SET_SOURCE_FILES_PROPERTIES (${libgncmod_backend_xml_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY(gncmod-backend-xml MODULE ${libgncmod_backend_xml_SOURCES})
+TARGET_LINK_LIBRARIES(gncmod-backend-xml gnc-backend-xml-utils gncmod-engine
+                        gnc-core-utils ${LIBXML2_LDFLAGS} ${GLIB2_LDFLAGS} ${ZLIB_LIBRARY})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-backend-xml PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\")
+
+SET(LIB_DIR lib/gnucash)
+IF (WIN32)
+  SET(LIB_DIR bin)
+ENDIF(WIN32)
+
+
+INSTALL(TARGETS gncmod-backend-xml
+  LIBRARY DESTINATION ${LIB_DIR}
+  ARCHIVE DESTINATION ${LIB_DIR}
+  RUNTIME DESTINATION bin)
+
+# ----
+
+# FIXME: Below is a hack to create .libs/libgncmod-backend-xml to silence some complaints
+# from guile when compiling. Eventually, fix the guile module loader to not expect items
+# to be in .libs. At this time, WIN32 does not use guile-2, so no need for this.
+
+IF (NOT WIN32)
+  SET(_LINK_TARGET ${CMAKE_CURRENT_BINARY_DIR}/.libs/libgncmod-backend-xml${CMAKE_SHARED_MODULE_SUFFIX})
+  FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.libs)
+
+  ADD_CUSTOM_COMMAND(
+      OUTPUT ${_LINK_TARGET}
+      COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:gncmod-backend-xml> ${_LINK_TARGET}
+      DEPENDS gnc-backend-xml-utils
   )
+
+  ADD_CUSTOM_TARGET(gncmod-backend-xml-link ALL DEPENDS gncmod-backend-xml ${_LINK_TARGET})
+ENDIF()
diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt
new file mode 100644
index 0000000..98e3c2a
--- /dev/null
+++ b/src/bin/CMakeLists.txt
@@ -0,0 +1,187 @@
+ADD_SUBDIRECTORY(overrides)
+
+# Some settings are platform dependent. Let's define them per platform.
+IF (WIN32)
+  # Windows specific settings go here:
+  SET (GNUCASH_RESOURCE_FILE gnucash.rc)
+
+ELSE (WIN32)
+  # All other platforms use these settings:
+  SET (PLATFORM_FILES gnucash-valgrind)
+
+ENDIF (WIN32)
+
+SET (gnucash_SOURCES
+  gnucash-bin.c
+  ${GNUCASH_RESOURCE_FILE}  
+)
+
+ADD_EXECUTABLE (gnucash
+  ${gnucash_SOURCES}
+)
+
+TARGET_COMPILE_DEFINITIONS(gnucash PRIVATE -DG_LOG_DOMAIN=\"gnc.bin\")
+
+TARGET_LINK_LIBRARIES (gnucash
+   gncmod-ledger-core gncmod-report-gnome gnc-gnome gncmod-gnome-utils gncmod-app-utils
+   gncmod-engine gnc-module gnc-core-utils gnc-qof gncmod-report-system
+   ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK2_LDFLAGS} ${GTK_MAC_LDFLAGS}
+)
+
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gnucash PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  TARGET_LINK_LIBRARIES(gnucash ${OSX_EXTRA_LIBRARIES})
+ENDIF(MAC_INTEGRATION)
+
+INSTALL(TARGETS gnucash DESTINATION bin)
+# No headers to install.
+
+# Generate the gnucash-env script
+SET(SCRIPT_LIST  "")
+SET(SCRIPT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+IF (GNC_BUILD_AS_INSTALL)
+  SET(SCRIPT_OUTPUT_DIR ${BINDIR_BUILD})
+ENDIF()
+
+FOREACH (script gnucash-env gnucash-make-guids)
+  SET (GNUCASH_ENV_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${script})
+  LIST(APPEND SCRIPT_LIST ${SCRIPT_OUTPUT_DIR}/${script})
+  SET (GNC_OVERRIDES_DIR ${CMAKE_INSTALL_PREFIX}/libexec/gnucash/overrides)
+  FILE(WRITE ${GNUCASH_ENV_SCRIPT} "#!/bin/sh\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "PATH=\"${GNC_OVERRIDES_DIR}:\${PATH}\"\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "export PATH\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "\nGUILE_WARN_DEPRECATED=\"no\"\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "export GUILE_WARN_DEPRECATED\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "\nexec \"${script}\" \"\$@\"\n")
+  FILE(COPY ${GNUCASH_ENV_SCRIPT}
+       DESTINATION ${SCRIPT_OUTPUT_DIR}
+       FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+  )
+ENDFOREACH(script)
+
+SET(TOP_SRC_DIR ${CMAKE_SOURCE_DIR})
+SET(GNUCASH_BIN_INSTALL_NAME "gnucash")
+
+SET(VALGRIND_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
+IF (GNC_BUILD_AS_INSTALL)
+  SET(VALGRIND_OUTDIR ${BINDIR_BUILD})
+ENDIF()
+
+GNC_CONFIGURE(gnucash-valgrind.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-valgrind)
+
+FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-valgrind
+          DESTINATION ${VALGRIND_OUTDIR}
+          FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+## Create the environment file
+
+FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/environment.in ENV_STRINGS_IN)
+
+SET(ENV_STRINGS_LIST "")
+
+FOREACH(line ${ENV_STRINGS_IN})
+  STRING(REGEX REPLACE "@-|-@" "@" line2 "${line}")
+    STRING(REPLACE ";" "\;" line3 "${line2}")
+  IF(NOT "${line3}" MATCHES "@NOTE")
+    LIST(APPEND ENV_STRINGS_LIST "${line3}\n")
+  ENDIF()
+ENDFOREACH()
+
+STRING(CONCAT ENV_STRINGS ${ENV_STRINGS_LIST})
+STRING(CONFIGURE "${ENV_STRINGS}" ENV_STRINGS_CONF @ONLY)
+
+SET(ENV_FILE_OUT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/environment)
+IF (GNC_BUILD_AS_INSTALL)
+  SET(BUILD_ENV_FILE_OUT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/environment.build)
+ENDIF()
+
+FILE(WRITE ${ENV_FILE_OUT} "${ENV_STRINGS_CONF}")
+FILE(WRITE ${BUILD_ENV_FILE_OUT} "${ENV_STRINGS_CONF}")
+
+SET(XDG_TEXT "
+# GnuCash was not installed in the default location.
+# XDG_DATA_DIRS will be set so that our documentation
+# and gsettings schema are found.\n"
+)
+
+IF (NOT(${GNC_DBD_DIR} STREQUAL "${CMAKE_PREFIX_PATH}/lib/dbd"))
+  FILE(APPEND ${ENV_FILE_OUT} "GNC_DBD_DIR=${GNC_DBD_DIR}")
+ENDIF()
+
+IF (NOT(${DATADIR} STREQUAL "/usr/share") AND NOT(${DATADIR} STREQUAL "/usr/local/share"))
+  FILE(APPEND ${ENV_FILE_OUT} ${XDG_TEXT})
+  FILE(APPEND ${ENV_FILE_OUT} "XDG_DATA_DIRS=${DATADIR};{XDG_DATA_DIRS}" "${GNC_SYSTEM_XDG_DATA_DIRS}\n")
+ENDIF()
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(APPEND ${BUILD_ENV_FILE_OUT} "GNC_DBD_DIR=${LIBDBI_DRIVERS_DIR}/dbd")
+
+  FILE(APPEND ${BUILD_ENV_FILE_OUT} ${XDG_TEXT})
+  FILE(APPEND ${BUILD_ENV_FILE_OUT} "XDG_DATA_DIRS=${DATADIR_BUILD};{XDG_DATA_DIRS};" "${GNC_SYSTEM_XDG_DATA_DIRS}\n")
+
+  FILE(COPY ${BUILD_ENV_FILE_OUT}
+    DESTINATION ${SYSCONFDIR_BUILD}/gnucash
+    FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+  )
+  FILE(RENAME
+    ${SYSCONFDIR_BUILD}/gnucash/environment.build
+    ${SYSCONFDIR_BUILD}/gnucash/environment
+  )
+ENDIF()
+
+SET(ENVIRONMENT_FILE_DIR ${CMAKE_CURRENT_BINARY_DIR})
+FILE(COPY ${ENV_FILE_OUT}
+  DESTINATION ${ENVIRONMENT_FILE_DIR}
+  FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+
+
+INSTALL(FILES ${SCRIPT_LIST} ${VALGRIND_OUTDIR}/gnucash-valgrind DESTINATION bin)
+INSTALL(FILES ${ENVIRONMENT_FILE_DIR}/environment DESTINATION etc/gnucash)
+
+IF (WIN32)
+  # Write out a command script for windows
+  SET(lib_directories boost enchant libsoup mysql pgsql libxslt)
+  SET(bin_directories mingw gnutls goffice libgsf pcre gnome guile webkit regex aqbanking gwenhywfar libofx opensp
+    libdbi sqlite3 mysql pgsql enchant libsoup libxslt)
+
+  SET(CMD_LINES "")
+  SET(BUILD_CMD_LINES "")
+  FOREACH(dir bin lib lib/gnucash)
+    FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${dir} INSTALL_PATH_ITEM)
+    FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/${dir} BUILD_PATH_ITEM)
+    LIST(APPEND CMD_LINES "set PATH=${INSTALL_PATH_ITEM}\;%PATH%\n")
+    LIST(APPEND BUILD_CMD_LINES "set PATH=${BUILD_PATH_ITEM}\;%PATH%\n")
+  ENDFOREACH(dir)
+
+  FOREACH(dir ${lib_directories})
+    FILE(TO_NATIVE_PATH ${CMAKE_PREFIX_PATH}/${dir}/lib PATH_ITEM)
+    LIST(APPEND CMD_LINES "set PATH=${PATH_ITEM}\;%PATH%\n")
+  ENDFOREACH(dir)
+
+  FOREACH(dir ${bin_directories})
+    FILE(TO_NATIVE_PATH ${CMAKE_PREFIX_PATH}/${dir}/bin PATH_ITEM)
+    LIST(APPEND CMD_LINES "set PATH=${PATH_ITEM}\;%PATH%\n")
+  ENDFOREACH(dir)
+
+  SET(CMD_FILE ${CMAKE_CURRENT_BINARY_DIR}/gnucash-launcher.cmd)
+  FILE(WRITE ${CMD_FILE} "@echo off\nsetlocal\n\n")
+  FOREACH(line ${CMD_LINES})
+    FILE(APPEND ${CMD_FILE} "${line}")
+  ENDFOREACH(line)
+  FILE(APPEND ${CMD_FILE} "\nstart gnucash %*\n")
+
+  IF (GNC_BUILD_AS_INSTALL)
+    SET(BUILD_CMD_FILE ${CMAKE_BINARY_DIR}/bin/gnucash-launcher.cmd)
+    FILE(WRITE ${BUILD_CMD_FILE} "@echo off\nsetlocal\n\n")
+    FOREACH(line ${CMD_LINES})
+      FILE(APPEND ${BUILD_CMD_FILE} "${line}")
+    ENDFOREACH(line)
+    FILE(APPEND ${BUILD_CMD_FILE} "\nstart gnucash %*\n")
+  ENDIF()
+
+  INSTALL(PROGRAMS ${CMD_FILE} DESTINATION bin)
+ENDIF(WIN32)
diff --git a/src/bin/overrides/CMakeLists.txt b/src/bin/overrides/CMakeLists.txt
new file mode 100644
index 0000000..0390377
--- /dev/null
+++ b/src/bin/overrides/CMakeLists.txt
@@ -0,0 +1,33 @@
+
+SET(GNC_PKGLIB_INSTALLDIR ${PKGLIBDIR})
+SET(GNC_SCM_INSTALLDIR ${SCHEME_INSTALLED_SOURCE_DIR})
+SET(GNC_LIB_INSTALLDIR ${LIBDIR})
+SET(GNC_PYTHON_DIR ${GNUCASH_PATH_DIR})
+SET(GUILE ${GUILE_EXECUTABLE})
+SET(GNC_SRCDIR ${CMAKE_SOURCE_DIR})
+SET(GNC_BUILDDIR ${CMAKE_BINARY_DIR})
+
+CONFIGURE_FILE(gnucash-make-guids.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-make-guids)
+GNC_CONFIGURE(gnucash-env.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-env)
+GNC_CONFIGURE(guile.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/guile)
+GNC_CONFIGURE(gnucash-build-env.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-build-env)   # not installed
+
+SET(SCRIPT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+IF (GNC_BUILD_AS_INSTALL)
+  SET(SCRIPT_OUTPUT_DIR ${LIBDIR_BUILD}exec/gnucash/overrides)
+ENDIF()
+
+FOREACH(file gnucash-make-guids gnucash-env guile gnucash-build-env)
+  FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${file}
+       DESTINATION ${SCRIPT_OUTPUT_DIR}
+       FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+  )
+ENDFOREACH(file)
+
+INSTALL(
+    PROGRAMS
+      ${SCRIPT_OUTPUT_DIR}/gnucash-env
+      ${SCRIPT_OUTPUT_DIR}/gnucash-make-guids
+      ${SCRIPT_OUTPUT_DIR}/guile
+    DESTINATION libexec/gnucash/overrides
+)
\ No newline at end of file
diff --git a/src/business/business-gnome/CMakeLists.txt b/src/business/business-gnome/CMakeLists.txt
new file mode 100644
index 0000000..e33571a
--- /dev/null
+++ b/src/business/business-gnome/CMakeLists.txt
@@ -0,0 +1,82 @@
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET(business_gnome_SOURCES
+  business-options-gnome.c
+  business-urls.c
+  business-gnome-utils.c
+  dialog-billterms.c
+  dialog-choose-owner.c
+  dialog-customer.c
+  dialog-date-close.c
+  dialog-employee.c
+  dialog-invoice.c
+  dialog-job.c
+  dialog-order.c
+  dialog-payment.c
+  dialog-vendor.c
+  gnc-plugin-business.c
+  gnc-plugin-page-invoice.c
+  gnc-plugin-page-owner-tree.c
+  gncmod-business-gnome.c
+  search-owner.c
+)
+
+SET(business_gnome_noinst_HEADERS
+  business-options-gnome.h
+  business-urls.h
+  business-gnome-utils.h
+  dialog-billterms.h
+  dialog-choose-owner.h
+  dialog-customer.h
+  dialog-date-close.h
+  dialog-employee.h
+  dialog-invoice.h
+  dialog-job.h
+  dialog-order.h
+  dialog-payment.h
+  dialog-vendor.h
+  gnc-plugin-business.h
+  gnc-plugin-page-invoice.h
+  gnc-plugin-page-owner-tree.h
+  search-owner.h
+)  
+
+SET_SOURCE_FILES_PROPERTIES (${business_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (business-options-gnome.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
+ADD_LIBRARY(gncmod-business-gnome
+  ${business_gnome_SOURCES}
+  ${business_gnome_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-business-gnome gnc-business-ledger gncmod-gnome-search 
+   gncmod-report-gnome gncmod-gnome-utils gnc-gnome gncmod-engine gnc-qof ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-business-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.business.gnome\")
+
+INSTALL(TARGETS gncmod-business-gnome
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# Scheme
+
+SET(gncmod_business_gnome_SCHEME business-gnome.scm)
+
+SET(GUILE_OUTPUT_DIR   gnucash)
+SET(GUILE_MODULES      src/app-utils src/engine src/gnome-utils src/html src/report/report-system src/report/standard-reports)
+SET(GUILE_LOAD_DIRS    src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/business-reports src/report/report-system src/report/standard-reports src/scm)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/report-system)
+SET(GUILE_DEPENDS      scm-business-reports)
+
+GNC_ADD_SCHEME_TARGETS(scm-business-gnome
+  "${gncmod_business_gnome_SCHEME}"
+  ${GUILE_OUTPUT_DIR} 
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
\ No newline at end of file
diff --git a/src/business/business-gnome/gschemas/CMakeLists.txt b/src/business/business-gnome/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..cabe172
--- /dev/null
+++ b/src/business/business-gnome/gschemas/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+SET(business_gnome_GSCHEMA org.gnucash.dialogs.business.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(business-gnome-gschema "${business_gnome_GSCHEMA}")
\ No newline at end of file
diff --git a/src/business/business-gnome/gtkbuilder/CMakeLists.txt b/src/business/business-gnome/gtkbuilder/CMakeLists.txt
new file mode 100644
index 0000000..1d4d3d1
--- /dev/null
+++ b/src/business/business-gnome/gtkbuilder/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/business/business-gnome/ui/CMakeLists.txt b/src/business/business-gnome/ui/CMakeLists.txt
new file mode 100644
index 0000000..6c9019d
--- /dev/null
+++ b/src/business/business-gnome/ui/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/business/business-ledger/CMakeLists.txt b/src/business/business-ledger/CMakeLists.txt
new file mode 100644
index 0000000..6573f86
--- /dev/null
+++ b/src/business/business-ledger/CMakeLists.txt
@@ -0,0 +1,35 @@
+
+SET (gnc_business_ledger_SOURCES
+  gncEntryLedger.c
+  gncEntryLedgerControl.c
+  gncEntryLedgerDisplay.c
+  gncEntryLedgerLayout.c
+  gncEntryLedgerLoad.c
+  gncEntryLedgerModel.c
+)
+
+SET (gnc_business_ledger_noinst_HEADERS
+  gncEntryLedger.h
+  gncEntryLedgerP.h
+  gncEntryLedgerControl.h
+  gncEntryLedgerLayout.h
+  gncEntryLedgerModel.h
+)
+
+ADD_LIBRARY (gnc-business-ledger
+  ${gnc_business_ledger_SOURCES}
+  ${gnc_business_ledger_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gnc-business-ledger gncmod-ledger-core  gncmod-register-core gncmod-engine gncmod-gnome-utils
+                            gnc-core-utils ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gnc-business-ledger PRIVATE -DG_LOG_DOMAIN=\"gnc.business.ledger\")
+
+TARGET_INCLUDE_DIRECTORIES (gnc-business-ledger PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gnc-business-ledger
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+# No headers to install
\ No newline at end of file
diff --git a/src/cmake_modules/GncAddGSchemaTargets.cmake b/src/cmake_modules/GncAddGSchemaTargets.cmake
new file mode 100644
index 0000000..1b80d54
--- /dev/null
+++ b/src/cmake_modules/GncAddGSchemaTargets.cmake
@@ -0,0 +1,49 @@
+MACRO(ADD_GSCHEMA_TARGETS _TARGET _gschema_INPUTS)
+  SET(_gschema_OUTPUTS "")
+  SET(_gschema_VALIDS "")
+  SET(_gschema_BUILDS "")
+  # FIXME: I have no idea of I'm using the right options here for intltool-merge for Windows.
+  SET(INITTOOL_OPTIONS "--no-translations")
+  IF(WIN32)
+    SET(INITTOOL_OPTIONS "/tmp")
+  ENDIF(WIN32)
+  FOREACH(file ${_gschema_INPUTS})
+    GNC_CONFIGURE2(${file}.in.in ${file}.in)
+    STRING(REPLACE ".xml" ".valid" file_no_xml ${file})
+    SET(_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${file})
+    SET(_BUILD_FILE ${DATADIR_BUILD}/glib-2.0/schemas/${file})
+    SET(_VALID_FILE ${CMAKE_CURRENT_BINARY_DIR}/${file_no_xml})
+    LIST(APPEND _gschema_OUTPUTS ${_OUTPUT_FILE})
+    LIST(APPEND _gschema_VALIDS ${_VALID_FILE})
+    IF (GNC_BUILD_AS_INSTALL)
+      LIST(APPEND _gschema_BUILDS ${_BUILD_FILE})
+    ENDIF()
+    ADD_CUSTOM_COMMAND(
+        OUTPUT ${_OUTPUT_FILE}
+        COMMAND ${CMAKE_COMMAND} -E env
+          LC_ALL=C
+          ${PERL_EXECUTABLE} ${INTLTOOL_MERGE} -x -u ${INITTOOL_OPTIONS} ${CMAKE_CURRENT_BINARY_DIR}/${file}.in ${CMAKE_CURRENT_BINARY_DIR}/${file}
+        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${file}.in
+        MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${file}.in.in
+    )
+    IF (GNC_BUILD_AS_INSTALL)
+      ADD_CUSTOM_COMMAND(
+        OUTPUT ${_BUILD_FILE}
+        COMMAND ${CMAKE_COMMAND} -E copy ${_OUTPUT_FILE} ${_BUILD_FILE}
+        DEPENDS ${_OUTPUT_FILE}
+      )
+    ENDIF()
+    ADD_CUSTOM_COMMAND(
+        OUTPUT ${_VALID_FILE}
+        COMMAND ${CMAKE_COMMAND} -E env
+        ${GLIB_COMPILE_SCHEMAS} --strict --dry-run --schema-file=${_OUTPUT_FILE}
+        COMMAND ${CMAKE_COMMAND} -E touch ${_VALID_FILE}
+        DEPENDS ${_OUTPUT_FILE}
+    )
+  ENDFOREACH(file)
+
+  ADD_CUSTOM_TARGET(${_TARGET} DEPENDS "${_gschema_OUTPUTS};${_gschema_VALIDS};${_gschema_BUILDS}")
+
+  INSTALL(FILES ${_gschema_OUTPUTS} DESTINATION share/glib-2.0/schemas)
+
+ENDMACRO()
diff --git a/src/cmake_modules/GncAddSchemeTargets.cmake b/src/cmake_modules/GncAddSchemeTargets.cmake
new file mode 100644
index 0000000..b7ddceb
--- /dev/null
+++ b/src/cmake_modules/GncAddSchemeTargets.cmake
@@ -0,0 +1,142 @@
+# Copyright (c) 2015, Rob Gowin
+
+MACRO(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR_IN _GUILE_MODULES _GUILE_LOAD_DIRS _GUILE_LIBRARY_DIRS _GUILE_DEPENDS_IN MAKE_LINKS_IN)
+  SET(__DEBUG FALSE)
+  IF (__DEBUG)
+    MESSAGE("Parameters to COMPILE_SCHEME for target ${_TARGET}")
+    MESSAGE("   SOURCE_FILES: ${_SOURCE_FILES}")
+    MESSAGE("   GUILE_MODULES: ${_GUILE_MODULES}")
+    MESSAGE("   GUILE_LOAD_DIRS: ${_GUILE_LOAD_DIRS}")
+    MESSAGE("   GUILE_LIBRARY_DIRS: ${_GUILE_LIBRARY_DIRS}")
+    MESSAGE("   GUILE_DEPENDS_IN: ${_GUILE_DEPENDS_IN}")
+  ENDIF(__DEBUG)
+  SET(_CMD "create_symlink")
+  IF(WIN32)
+    SET(_CMD "copy")
+  ENDIF(WIN32)
+  SET(MAKE_LINKS ${MAKE_LINKS_IN})
+  SET(_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${_OUTPUT_DIR_IN})
+  IF(GNC_BUILD_AS_INSTALL)
+    SET(_OUTPUT_DIR ${DATADIR_BUILD}/gnucash/scm/${_OUTPUT_DIR_IN})
+  ENDIF()
+  FILE(MAKE_DIRECTORY ${_OUTPUT_DIR})
+  # For guile 1, we simple link (or copy, for Windows) each source file to the dest directory
+  IF(HAVE_GUILE1 OR MAKE_LINKS)
+    SET(_SCHEME_LINKS "")
+    FOREACH(scheme_file ${_SOURCE_FILES})
+      SET(_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${scheme_file})
+      IF(IS_ABSOLUTE ${scheme_file})
+        SET(_SOURCE_FILE ${scheme_file})
+      ENDIF()
+      GET_FILENAME_COMPONENT(name ${scheme_file} NAME)
+      SET(_OUTPUT_FILE ${_OUTPUT_DIR}/${name})
+      IF(NOT EXISTS ${_OUTPUT_FILE})
+        LIST(APPEND _SCHEME_LINKS ${_OUTPUT_FILE})
+        ADD_CUSTOM_COMMAND(
+            OUTPUT ${_OUTPUT_FILE}
+            COMMAND ${CMAKE_COMMAND} -E ${_CMD} ${_SOURCE_FILE} ${_OUTPUT_FILE}
+        )
+      ENDIF()
+    ENDFOREACH(scheme_file)
+    IF(HAVE_GUILE1)
+      ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS "${_SCHEME_LINKS}")
+    ELSE()
+      ADD_CUSTOM_TARGET(${_TARGET}-links ALL DEPENDS "${_SCHEME_LINKS}")
+    ENDIF()
+  ENDIF(HAVE_GUILE1 OR MAKE_LINKS)
+
+  IF(HAVE_GUILE2)
+    # Construct the guile source and compiled load paths
+    SET(_GUILE_LOAD_PATH "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR};${CMAKE_BINARY_DIR}/src/scm")  # to pick up generated build-config.scm
+    SET(_GUILE_LOAD_COMPILED_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+    FOREACH (load_item ${_GUILE_LOAD_DIRS})
+       LIST(APPEND _GUILE_LOAD_PATH ${CMAKE_SOURCE_DIR}/${load_item})
+       LIST(APPEND _GUILE_LOAD_COMPILED_PATH ${CMAKE_BINARY_DIR}/${load_item})
+    ENDFOREACH(load_item)
+
+    # Construct the LD_LIBRARY_PATH
+    SET(_GUILE_LD_LIBRARY_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
+    FOREACH(ld_item ${_GUILE_LIBRARY_DIRS})
+        LIST(APPEND _GUILE_LD_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${ld_item}/${CMAKE_BUILD_TYPE})
+    ENDFOREACH(ld_item)
+
+    # And then the module path
+    SET(_GNC_MODULE_PATH "")
+    FOREACH(module_item ${_GUILE_MODULES})
+      LIST(APPEND _GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/${module_item}/${CMAKE_BUILD_TYPE})
+    ENDFOREACH(module_item)
+
+    # In CMake lists are text strings where the items are separated by semicolons ("a;b;c;d" for example).
+    # Replace the semis with colons to construct the path environment variables
+    STRING(REPLACE ";" ":" _GUILE_LOAD_PATH "${_GUILE_LOAD_PATH}")
+    STRING(REPLACE ";" ":" _GUILE_LOAD_COMPILED_PATH "${_GUILE_LOAD_COMPILED_PATH}")
+    STRING(REPLACE ";" ":" _GUILE_MODULES "{_GUILE_MODULES}")
+    STRING(REPLACE ";" ":" _GUILE_LD_LIBRARY_PATH "${_GUILE_LD_LIBRARY_PATH}")
+    STRING(REPLACE ";" ":" _GNC_MODULE_PATH "${_GNC_MODULE_PATH}")
+
+    IF(GNC_BUILD_AS_INSTALL)
+      SET(_GUILE_CACHE_DIR ${LIBDIR_BUILD}/gnucash/scm/ccache/2.0)
+      SET(_GUILE_LOAD_PATH "${CMAKE_CURRENT_SOURCE_DIR}:${DATADIR_BUILD}/gnucash/scm")
+      SET(_GUILE_LOAD_COMPILED_PATH ${_GUILE_CACHE_DIR})
+#      SET(_GNC_MODULE_PATH  "${LIBDIR_BUILD}/${CMAKE_BUILD_TYPE}:${LIBDIR_BUILD}/gnucash/${CMAKE_BUILD_TYPE}")
+      SET(_GNC_MODULE_PATH  "")
+      SET(_GUILE_LD_LIBRARY_PATH ${_GNC_MODULE_PATH})
+    ENDIF()
+    IF (__DEBUG)
+      MESSAGE("  ")
+      MESSAGE("   GUILE_LOAD_PATH: ${_GUILE_LOAD_PATH}")
+      MESSAGE("   GUILE_LOAD_COMPILED_PATH: ${_GUILE_LOAD_COMPILED_PATH}")
+      MESSAGE("   GUILE_LD_LIBRARY_PATH: ${_GUILE_LD_LIBRARY_PATH}")
+      MESSAGE("   GNC_MODULE_PATH: ${_GNC_MODULE_PATH}")
+    ENDIF(__DEBUG)
+    SET(_TARGET_FILES "")
+
+    FOREACH(source_file ${_SOURCE_FILES})
+      SET(guile_depends ${_GUILE_DEPENDS_IN})
+      GET_FILENAME_COMPONENT(basename ${source_file} NAME_WE)
+
+      SET(output_file ${basename}.go)
+      SET(_TMP_OUTPUT_DIR_IN ${_OUTPUT_DIR_IN})
+      IF (_TMP_OUTPUT_DIR_IN)
+        SET(output_file ${_OUTPUT_DIR_IN}/${basename}.go)
+      ENDIF()
+      IF(GNC_BUILD_AS_INSTALL)
+        SET(output_file ${_GUILE_CACHE_DIR}/${output_file})
+        LIST(APPEND _TARGET_FILES ${output_file})
+      ELSE()
+        LIST(APPEND _TARGET_FILES ${CMAKE_CURRENT_BINARY_DIR}/${output_file})
+      ENDIF()
+
+      SET(source_file_abs_path ${CMAKE_CURRENT_SOURCE_DIR}/${source_file})
+      IF (IS_ABSOLUTE ${source_file})
+        SET(source_file_abs_path ${source_file})
+      ENDIF()
+      IF (__DEBUG)
+        MESSAGE("ADD_CUSTOM_COMMAND: output = ${output_file}")
+      ENDIF()
+      ADD_CUSTOM_COMMAND(
+        OUTPUT ${output_file}
+        COMMAND ${CMAKE_COMMAND} -E env
+           GNC_UNINSTALLED=${_GNC_UNINSTALLED}
+           GNC_BUILDDIR=${CMAKE_BINARY_DIR}
+           #DYLD_FALLBACK_LIBRARY_PATH=${Boost_LIBRARY_DIRS} # this is hack for OS X
+           LD_LIBRARY_PATH="${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${_GUILE_LD_LIBRARY_PATH}"
+           DYLD_LIBRARY_PATH="${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${_GUILE_LD_LIBRARY_PATH}"
+           GUILE_LOAD_PATH=${_GUILE_LOAD_PATH}
+           GUILE_LOAD_COMPILED_PATH=${_GUILE_LOAD_COMPILED_PATH}
+           #GNC_MODULE_PATH=${_GNC_MODULE_PATH}
+           GNC_MODULE_PATH="${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${GNC_MODULE_PATH}"
+           ${GUILE_EXECUTABLE} -e '\(@@ \(guild\) main\)' -s ${GUILD_EXECUTABLE} compile -o ${output_file} ${source_file_abs_path}
+        DEPENDS ${guile_depends}
+        MAIN_DEPENDENCY ${source_file_abs_path}
+      )
+    ENDFOREACH(source_file)
+    IF (__DEBUG)
+      MESSAGE("TARGET_FILES are ${_TARGET_FILES}")
+    ENDIF(__DEBUG)
+    ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_TARGET_FILES})
+    INSTALL(FILES ${_TARGET_FILES} DESTINATION ${SCHEME_INSTALLED_CACHE_DIR}/${_OUTPUT_DIR_IN})
+
+  ENDIF(HAVE_GUILE2)
+  INSTALL(FILES ${_SOURCE_FILES} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/${_OUTPUT_DIR_IN})
+ENDMACRO(GNC_ADD_SCHEME_TARGETS)
diff --git a/src/cmake_modules/GncConfigure.cmake b/src/cmake_modules/GncConfigure.cmake
new file mode 100644
index 0000000..8643e8a
--- /dev/null
+++ b/src/cmake_modules/GncConfigure.cmake
@@ -0,0 +1,42 @@
+
+MACRO (GNC_CONFIGURE _INPUT _OUTPUT)
+  FILE(READ ${_INPUT} FILE_CONTENTS_IN_IN)
+  SET(FILE_CONTENTS_IN "${FILE_CONTENTS_IN_IN}")
+  STRING(REGEX REPLACE "@-|-@" "@" _TMP2 "${FILE_CONTENTS_IN}")
+  STRING(CONFIGURE "${_TMP2}" FILE_CONTENTS @ONLY)
+  SET(_OUTPUT_FILE ${_OUTPUT})
+  IF (NOT IS_ABSOLUTE ${_OUTPUT})
+    SET(_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_OUTPUT})
+  ENDIF()
+  FILE(WRITE ${_OUTPUT_FILE} "${FILE_CONTENTS}")
+ENDMACRO()
+
+
+MACRO (GNC_CONFIGURE2 _INPUT _OUTPUT)
+
+  SET(_TMPDIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+  FILE(READ ${_INPUT} FILE_CONTENTS_IN_IN)
+  SET(FILE_CONTENTS_IN "${FILE_CONTENTS_IN_IN}")
+  STRING(REGEX REPLACE "@-|-@" "@" _TMP2 "${FILE_CONTENTS_IN}")
+  FILE(WRITE ${_TMPDIR}/${_INPUT}.tmp "${_TMP2}")
+
+  FILE(WRITE ${_TMPDIR}/${_INPUT}.cmake
+    "SET(PERL ${PERL_EXECUTABLE})
+     SET(VERSION ${VERSION})
+     SET(GNC_HELPDIR ${GNC_HELPDIR})
+     SET(GETTEXT_PACKAGE ${GETTEXT_PACKAGE})
+     CONFIGURE_FILE(\${SRC} \${DST} @ONLY)")
+
+  SET(_OUTPUT_FILE ${_OUTPUT})
+  IF (NOT IS_ABSOLUTE ${_OUTPUT})
+    SET(_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_OUTPUT})
+  ENDIF()
+
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${_OUTPUT_FILE}
+    COMMAND ${CMAKE_COMMAND} -D SRC=${_TMPDIR}/${_INPUT}.tmp
+                             -D DST=${_OUTPUT_FILE}
+                             -P ${_TMPDIR}/${_INPUT}.cmake
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_INPUT}
+  )
+ENDMACRO()
\ No newline at end of file
diff --git a/src/cmake_modules/GncFindPkgConfig.cmake b/src/cmake_modules/GncFindPkgConfig.cmake
new file mode 100644
index 0000000..f79316e
--- /dev/null
+++ b/src/cmake_modules/GncFindPkgConfig.cmake
@@ -0,0 +1,248 @@
+function (pkg_get_variable result pkg variable)
+  _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}")
+  set("${result}"
+          "${prefix_result}"
+          PARENT_SCOPE)
+endfunction ()
+
+
+macro(_gnc_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix)
+  _pkgconfig_unset(${_prefix}_FOUND)
+  _pkgconfig_unset(${_prefix}_VERSION)
+  _pkgconfig_unset(${_prefix}_PREFIX)
+  _pkgconfig_unset(${_prefix}_INCLUDEDIR)
+  _pkgconfig_unset(${_prefix}_LIBDIR)
+  _pkgconfig_unset(${_prefix}_LIBS)
+  _pkgconfig_unset(${_prefix}_LIBS_L)
+  _pkgconfig_unset(${_prefix}_LIBS_PATHS)
+  _pkgconfig_unset(${_prefix}_LIBS_OTHER)
+  _pkgconfig_unset(${_prefix}_CFLAGS)
+  _pkgconfig_unset(${_prefix}_CFLAGS_I)
+  _pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
+  _pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
+  _pkgconfig_unset(${_prefix}_STATIC_LIBS)
+  _pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
+  _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
+  _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
+  _pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
+  _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
+  _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
+
+  # create a better addressable variable of the modules and calculate its size
+  set(_pkg_check_modules_list ${ARGN})
+  list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
+
+  if(PKG_CONFIG_EXECUTABLE)
+    # give out status message telling checked module
+    if (NOT ${_is_silent})
+      if (_pkg_check_modules_cnt EQUAL 1)
+        message(STATUS "Checking for module '${_pkg_check_modules_list}'")
+      else()
+        message(STATUS "Checking for modules '${_pkg_check_modules_list}'")
+      endif()
+    endif()
+
+    set(_pkg_check_modules_packages)
+    set(_pkg_check_modules_failed)
+
+    set(_extra_paths)
+
+    if(NOT _no_cmake_path)
+      _pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
+      _pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
+      _pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
+    endif()
+
+    if(NOT _no_cmake_environment_path)
+      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
+      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
+      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
+    endif()
+
+    if(NOT "${_extra_paths}" STREQUAL "")
+      # Save the PKG_CONFIG_PATH environment variable, and add paths
+      # from the CMAKE_PREFIX_PATH variables
+      set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH})
+      set(_pkgconfig_path ${_pkgconfig_path_old})
+      if(NOT "${_pkgconfig_path}" STREQUAL "")
+        file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+      endif()
+
+      # Create a list of the possible pkgconfig subfolder (depending on
+      # the system
+      set(_lib_dirs)
+      if(NOT DEFINED CMAKE_SYSTEM_NAME
+          OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+              AND NOT CMAKE_CROSSCOMPILING))
+        if(EXISTS "/etc/debian_version") # is this a debian system ?
+          if(CMAKE_LIBRARY_ARCHITECTURE)
+            list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+          endif()
+        else()
+          # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+          get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+          if(uselib64)
+            list(APPEND _lib_dirs "lib64/pkgconfig")
+          endif()
+        endif()
+      endif()
+      list(APPEND _lib_dirs "lib/pkgconfig")
+
+      # Check if directories exist and eventually append them to the
+      # pkgconfig path list
+      foreach(_prefix_dir ${_extra_paths})
+        foreach(_lib_dir ${_lib_dirs})
+          if(EXISTS "${_prefix_dir}/${_lib_dir}")
+            list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
+            list(REMOVE_DUPLICATES _pkgconfig_path)
+          endif()
+        endforeach()
+      endforeach()
+
+      # Prepare and set the environment variable
+      if(NOT "${_pkgconfig_path}" STREQUAL "")
+        # remove empty values from the list
+        list(REMOVE_ITEM _pkgconfig_path "")
+        file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+        if(UNIX)
+          string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
+          string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
+        endif()
+        set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path}")
+      endif()
+
+      # Unset variables
+      unset(_lib_dirs)
+      unset(_pkgconfig_path)
+    endif()
+
+    # iterate through module list and check whether they exist and match the required version
+    foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
+      set(_pkg_check_modules_exist_query)
+
+      # check whether version is given
+      if (_pkg_check_modules_pkg MATCHES "(.*[^><])(>=|=|<=)(.*)")
+        set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}")
+        set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}")
+        set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}")
+      else()
+        set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
+        set(_pkg_check_modules_pkg_op)
+        set(_pkg_check_modules_pkg_ver)
+      endif()
+
+      # handle the operands
+      if (_pkg_check_modules_pkg_op STREQUAL ">=")
+        list(APPEND _pkg_check_modules_exist_query --atleast-version)
+      endif()
+
+      if (_pkg_check_modules_pkg_op STREQUAL "=")
+        list(APPEND _pkg_check_modules_exist_query --exact-version)
+      endif()
+
+      if (_pkg_check_modules_pkg_op STREQUAL "<=")
+        list(APPEND _pkg_check_modules_exist_query --max-version)
+      endif()
+
+      # create the final query which is of the format:
+      # * --atleast-version <version> <pkg-name>
+      # * --exact-version <version> <pkg-name>
+      # * --max-version <version> <pkg-name>
+      # * --exists <pkg-name>
+      if (_pkg_check_modules_pkg_op)
+        list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
+      else()
+        list(APPEND _pkg_check_modules_exist_query --exists)
+      endif()
+
+      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
+      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
+      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
+      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
+
+      list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
+      list(APPEND _pkg_check_modules_packages    "${_pkg_check_modules_pkg_name}")
+
+      # execute the query
+      execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
+        RESULT_VARIABLE _pkgconfig_retval)
+
+      # evaluate result and tell failures
+      if (_pkgconfig_retval)
+        if(NOT ${_is_silent})
+          message(STATUS "  Package '${_pkg_check_modules_pkg}' not found")
+        endif()
+
+        set(_pkg_check_modules_failed 1)
+      endif()
+    endforeach()
+
+    if(_pkg_check_modules_failed)
+      # fail when requested
+      if (${_is_required})
+        message(FATAL_ERROR "A required package was not found")
+      endif ()
+    else()
+      # when we are here, we checked whether requested modules
+      # exist. Now, go through them and set variables
+
+      _pkgconfig_set(${_prefix}_FOUND 1)
+      list(LENGTH _pkg_check_modules_packages pkg_count)
+
+      # iterate through all modules again and set individual variables
+      foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
+        # handle case when there is only one package required
+        if (pkg_count EQUAL 1)
+          set(_pkg_check_prefix "${_prefix}")
+        else()
+          set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
+        endif()
+
+        _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION    ""   --modversion )
+        pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix")
+        pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir")
+        pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir")
+
+        if (NOT ${_is_silent})
+          message(STATUS "  Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+        endif ()
+      endforeach()
+
+      # set variables which are combined for multiple modules
+      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES           "(^| )-l" --libs-only-l )
+      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS        "(^| )-L" --libs-only-L )
+      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS             ""        --libs )
+      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER       ""        --libs-only-other )
+
+      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS        "(^| )-I" --cflags-only-I )
+      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS              ""        --cflags )
+      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER        ""        --cflags-only-other )
+    endif()
+
+    if(NOT "${_extra_paths}" STREQUAL "")
+      # Restore the environment variable
+      set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
+    endif()
+
+    unset(_extra_paths)
+    unset(_pkgconfig_path_old)
+  else()
+    if (${_is_required})
+      message(SEND_ERROR "pkg-config tool not found")
+    endif ()
+  endif()
+endmacro()
+
+
+
+macro(gnc_pkg_check_modules _prefix _module0)
+  # check cached value
+  if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
+    _pkgconfig_parse_options   (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
+    _gnc_pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules})
+
+    _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+  endif()
+endmacro()
+
diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in
index 6b738d3..c4754cb 100644
--- a/src/config.h.cmake.in
+++ b/src/config.h.cmake.in
@@ -1,77 +1,343 @@
 /* Template file for processing by the cmake command CONFIGURE_FILE */
 
-#define PACKAGE "@PROJECT_NAME@"
-#define GNUCASH_MAJOR_VERSION @CUTECASH_VERSION_MAJOR@
-#define GNUCASH_MICRO_VERSION @CUTECASH_VERSION_MINOR@
-#define GNUCASH_MINOR_VERSION @CUTECASH_VERSION_PATCH@
-#define GNUCASH_NANO_VERSION @CUTECASH_VERSION_NANO@
-#define GNUCASH_RESAVE_VERSION @GNUCASH_RESAVE_VERSION@
-#define VERSION "@CUTECASH_VERSION_MAJOR at .@CUTECASH_VERSION_MINOR at .@CUTECASH_VERSION_PATCH@"
 
-/* Definitions for all OS */
-#define HAVE_LIBQOF /**/
-#define HAVE_TOWUPPER 1
-#define QOF_DISABLE_DEPRECATED 1
-#define GNC_NO_LOADABLE_MODULES 1
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD
 
-/* WIN32 */
-#cmakedefine HAVE_HTMLHELPW 1
-#cmakedefine OS_WIN32 1
+/* Include pthread support for binary relocation? */
+#cmakedefine BR_PTHREAD 1
+
+/* Enable debug memory */
+#cmakedefine01 DEBUG_MEMORY
+
+/* Use binary relocation? */
+#cmakedefine ENABLE_BINRELOC
+
+/* always defined to indicate that i18n is enabled */
+#cmakedefine ENABLE_NLS 1
+
+/* Don't use deprecated gdk functions */
+#cmakedefine GDK_DISABLE_DEPRECATED 1
+
+/* Don't use deprecated gdk-pixbuf functions */
+#cmakedefine GDK_PIXBUF_DISABLE_DEPRECATED 1
 
-/* Unix or Mingw or Win32 */
+/* Using GDK Quartz (not X11) */
+#cmakedefine GDK_QUARTZ
+
+/* GetText version number */
 #define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
+
+/* Cocoa/Nexstep/GnuStep framework */
+#cmakedefine GNC_PLATFORM_COCOA 1
+
+/* Darwin-based OS */
+#cmakedefine GNC_PLATFORM_DARWIN 1
+
+/* Running on OSX, either X11 or Quartz */
+#cmakedefine GNC_PLATFORM_OSX 1
+
+/* POSIX-compliant OS */
+#cmakedefine GNC_PLATFORM_POSIX 1
+
+/* Microsoft Windows OS */
+#cmakedefine GNC_PLATFORM_WINDOWS 1
+
+/* using GNOME */
+#cmakedefine GNOME
+
+/* Don't use deprecated gnome functions */
+#cmakedefine GNOME_DISABLE_DEPRECATED
+
+/* Most recent stable GnuCash series */
+#define GNUCASH_LATEST_STABLE_SERIES "@GNUCASH_LATEST_STABLE_SERIES@"
+
+/* GnuCash Major version number */
+#define GNUCASH_MAJOR_VERSION @GNUCASH_MAJOR_VERSION@
+
+/* GnuCash Micro version number */
+#define GNUCASH_MICRO_VERSION @GNUCASH_MICRO_VERSION@
+
+/* GnuCash Minor version number */
+#define GNUCASH_MINOR_VERSION @GNUCASH_MINOR_VERSION@
+
+/* GnuCash Nano version number */
+#define GNUCASH_NANO_VERSION @GNUCASH_NANO_VERSION@
+
+/* GnuCash earliest compatible databaseversion number */
+#define GNUCASH_RESAVE_VERSION @GNUCASH_RESAVE_VERSION@
+
+/* Don't use deprecated gtk functions */
+#cmakedefine GTK_DISABLE_DEPRECATED 1
+
+/* Don't use deprecated glib functions */
+#cmakedefine G_DISABLE_DEPRECATED 1
+
+/* Define to 1 if you have the `bind_textdomain_codeset' function. */
 #cmakedefine HAVE_BIND_TEXTDOMAIN_CODESET 1
+
+/* define if the Boost library is available */
+#cmakedefine HAVE_BOOST
+
+/* Define to 1 if you have the `chown' function. */
 #cmakedefine HAVE_CHOWN 1
+
+/* define if the compiler supports basic C++11 syntax */
+#cmakedefine HAVE_CXX11 1
+
+/* Define to 1 if you have the <dbi/dbi.h> header file. */
+#cmakedefine HAVE_DBI_DBI_H 1
+
+/* Define to 1 if you have the `dcgettext' function. */
 #cmakedefine HAVE_DCGETTEXT 1
+
+/* Define to 1 if you have the <dirent.h> header file. */
 #cmakedefine HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dlerror' function. */
 #cmakedefine HAVE_DLERROR 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
 #cmakedefine HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlsym' function. */
+#cmakedefine HAVE_DLSYM 1
+
+/* Define to 1 if you have the <dl.h> header file. */
+#cmakedefine HAVE_DL_H 1
+
+/* Define to 1 if you have the `gethostid' function. */
 #cmakedefine HAVE_GETHOSTID 1
+
+/* Define to 1 if you have the `gethostname' function. */
 #cmakedefine HAVE_GETHOSTNAME 1
+
+/* Define to 1 if you have the `getppid' function. */
 #cmakedefine HAVE_GETPPID 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
 #cmakedefine HAVE_GETTEXT 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
 #cmakedefine HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the `getuid' function. */
 #cmakedefine HAVE_GETUID 1
+
+/* Configure gthread deprecations */
+#cmakedefine HAVE_GLIB_2_32 1
+
+/* Configure g_type_init deprecation */
+#cmakedefine HAVE_GLIB_2_36 1
+
+/* Configure leading quote around assertions */
+#cmakedefine HAVE_GLIB_2_38 1
+
+/* Define to 1 if you have the <glob.h> header file. */
 #cmakedefine HAVE_GLOB_H 1
+
+/* Define to 1 if you have the `gmtime_r' function. */
 #cmakedefine HAVE_GMTIME_R 1
-#cmakedefine HAVE_GUILE 1
+
+/* System has gnome-keyring 0.6 or better */
+#cmakedefine HAVE_GNOME_KEYRING 1
+
+/* System has HtmlHelpW */
+#cmakedefine HAVE_HTMLHELPW 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
 #cmakedefine HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <ktoblzcheck.h> header file. */
+#cmakedefine HAVE_KTOBLZCHECK_H 1
+
+/* Define if you have <langinfo.h> and nl_langinfo(D_FMT). */
 #cmakedefine HAVE_LANGINFO_D_FMT 1
+
+/* Define if your <locale.h> file defines LC_MESSAGES. */
 #cmakedefine HAVE_LC_MESSAGES 1
-#cmakedefine HAVE_LIBM 1
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
 #cmakedefine HAVE_LIBPTHREAD 1
+
+/* System has libsecret 0.18 or better */
+#cmakedefine HAVE_LIBSECRET 1
+
+/* Define to 1 if you have the <limits.h> header file. */
 #cmakedefine HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the `link' function. */
 #cmakedefine HAVE_LINK 1
+
+/* Define to 1 if you have the <locale.h> header file. */
 #cmakedefine HAVE_LOCALE_H 1
-#cmakedefine HAVE_LOCALTIME_R 1
+
+/* Define to 1 if you have the <ltdl.h> header file. */
+#cmakedefine HAVE_LTDL_H 1
+
+/* Define to 1 if you have the <mcheck.h> header file. */
+#cmakedefine HAVE_MCHECK_H 1
+
+/* Define to 1 if you have the `memcpy' function. */
 #cmakedefine HAVE_MEMCPY 1
+
+/* Define to 1 if you have the <memory.h> header file. */
 #cmakedefine HAVE_MEMORY_H 1
+
+/* System has an OS X Key chain */
+#cmakedefine HAVE_OSX_KEYCHAIN 1
+
+/* Define to 1 if you have the <pow.h> header file. */
+#cmakedefine HAVE_POW_H 1
+
+/* Define to 1 if you have the `pthread_mutex_init' function. */
 #cmakedefine HAVE_PTHREAD_MUTEX_INIT 1
+
+/* Have PTHREAD_PRIO_INHERIT. */
+#cmakedefine HAVE_PTHREAD_PRIO_INHERIT 1
+
+/* Define to 1 if you have the `putenv' function. */
 #cmakedefine HAVE_PUTENV 1
+
+/* If available, contains the Python version number currently in use. */
+#cmakedefine HAVE_PYTHON 1
+
+/* Define if scanf supports %I64d conversions. */
 #cmakedefine HAVE_SCANF_I64D 1
+
+/* Define if scanf supports %lld conversions. */
 #cmakedefine HAVE_SCANF_LLD 1
+
+/* Define if scanf supports %qd conversions. */
+#cmakedefine HAVE_SCANF_QD 1
+
+/* Define to 1 if you have the `setenv' function. */
 #cmakedefine HAVE_SETENV 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
 #cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
 #cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `stpcpy' function. */
 #cmakedefine HAVE_STPCPY 1
+
+/* Define to 1 if you have the `strfmon' function. */
+#cmakedefine HAVE_STRFMON 1
+
+/* Define to 1 if you have the <strings.h> header file. */
 #cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
 #cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strptime' function. */
 #cmakedefine HAVE_STRPTIME 1
+
+/* Define if you have the tm_gmtoff member of struct tm. */
 #cmakedefine HAVE_STRUCT_TM_GMTOFF 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
 #cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/times.h> header file. */
 #cmakedefine HAVE_SYS_TIMES_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
 #cmakedefine HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
 #cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
 #cmakedefine HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the `timegm' function. */
 #cmakedefine HAVE_TIMEGM 1
+
+/* Define to 1 if you have the `towupper' function. */
+#cmakedefine HAVE_TOWUPPER 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <utmp.h> header file. */
 #cmakedefine HAVE_UTMP_H 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
 #cmakedefine HAVE_WCTYPE_H 1
+
+/* webkit_web_frame_print_full exists */
+#cmakedefine HAVE_WEBKIT_WEB_FRAME_PRINT_FULL 1
+
+/* Define to 1 if you have the `webkit_web_view_load_uri' function. */
+#cmakedefine HAVE_WEBKIT_WEB_VIEW_LOAD_URI 1
+
+/* Define to 1 if you have the <X11/Xlib.h> header file. */
 #cmakedefine HAVE_X11_XLIB_H 1
 
+/* Define to 1 if you have the file `/usr/include/gmock/gmock.h'. */
+#cmakedefine HAVE__USR_INCLUDE_GMOCK_GMOCK_H
+
+/* Define to 1 if you have the file `/usr/include/gtest/gtest.h'. */
+#cmakedefine HAVE__USR_INCLUDE_GTEST_GTEST_H 1
+
+/* Define to 1 if you have the file `/usr/src/gmock/gmock-all.cc'. */
+#cmakedefine HAVE__USR_SRC_GMOCK_GMOCK_ALL_CC 1
+
+/* Define to 1 if you have the file `/usr/src/gmock/src/gmock-all.cc'. */
+#cmakedefine HAVE__USR_SRC_GMOCK_SRC_GMOCK_ALL_CC 1
+
+/* Define to 1 if you have the file `/usr/src/gtest/gtest-main.cc'. */
+#cmakedefine HAVE__USR_SRC_GTEST_GTEST_MAIN_CC 1
+
+/* Define to 1 if you have the file `/usr/src/gtest/src/gtest-all.cc'. */
+#cmakedefine HAVE__USR_SRC_GTEST_SRC_GTEST_ALL_CC 1
+
+/* Enable the experimental locale-specific tax categories */
+#cmakedefine LOCALE_SPECIFIC_TAX 1
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "@PACKAGE@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "@PACKAGE_NAME@"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "@PACKAGE_STRING@"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL "@PACKAGE_URL@"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+#cmakedefine PTHREAD_CREATE_JOINABLE 1
+
+/* Name of package containing qt3-wizard. */
+#define QT3_WIZARD_PACKAGE "aqbanking"
+
+/* We are not using Register2 */
+#cmakedefine REGISTER2_ENABLED 1
+
 /* Define to 1 if you have the ANSI C header files. */
 #cmakedefine STDC_HEADERS 1
 
+/* We are using EFence */
+#cmakedefine USE_EFENCE 1
+
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 #cmakedefine _ALL_SOURCE 1
@@ -93,8 +359,34 @@
 #cmakedefine __EXTENSIONS__ 1
 #endif
 
+
+/* Version number of package */
+#define VERSION "@VERSION@"
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
 #if defined AC_APPLE_UNIVERSAL_BUILD
 # if defined __BIG_ENDIAN__
-#cmakedefine WORDS_BIGENDIAN 1
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#cmakedefine WORDS_BIGENDIAN
 # endif
 #endif
+
+/* Define to 1 if on MINIX. */
+#cmakedefine _MINIX 1
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#cmakedefine _POSIX_1_SOURCE 1
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#cmakedefine _POSIX_SOURCE 1
+
+/* Definitions for all OS */
+/* From cutecash */
+//#define HAVE_LIBQOF /**/
+//#define QOF_DISABLE_DEPRECATED 1
+//#define GNC_NO_LOADABLE_MODULES 1
diff --git a/src/core-utils/CMakeLists.txt b/src/core-utils/CMakeLists.txt
index b9c2d50..55eab99 100644
--- a/src/core-utils/CMakeLists.txt
+++ b/src/core-utils/CMakeLists.txt
@@ -1,25 +1,14 @@
 # CMakeLists.txt for src/core-utils
 
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.core-utils\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GCONF2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}/..) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}/../libqof/qof) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # when building swig-core-utils.c
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) # for gncla-dir.h, gnc-version.h
 
 # Command to generate the swig-engine.c wrapper file
 SET (SWIG_CORE_UTILS_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils.c)
 GNC_ADD_SWIG_COMMAND (${SWIG_CORE_UTILS_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
 
-SET (libgnc_core_utils_SOURCES
+SET (core_utils_SOURCES
   binreloc.c
   gnc-prefs.c
+  gnc-environment.c
   gnc-filepath-utils.c
   gnc-features.c
   gnc-gdate-utils.c
@@ -34,44 +23,75 @@ SET (libgnc_core_utils_SOURCES
 )
 
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
 # Command to generate the swig-runtime.h header
 ADD_CUSTOM_COMMAND (
-  OUTPUT ${SWIG_RUNTIME_H}
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
-  COMMAND ${SWIG_EXECUTABLE} -guile -external-runtime ${SWIG_RUNTIME_H}
+ OUTPUT ${SWIG_RUNTIME_H}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
+ COMMAND ${SWIG_EXECUTABLE} -guile -external-runtime ${SWIG_RUNTIME_H}
 )
 
 # Add dependency on swig-runtime.h
 SET_SOURCE_FILES_PROPERTIES (gnc-guile-utils.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
 
-# Workaround to create a very simple gncla-dir.h file
-FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gncla-dir.h "
-#define PREFIX \"${CMAKE_INSTALL_PREFIX}\"
-#define DATADIR \"${CMAKE_INSTALL_PREFIX}/share\"
-#define SYSCONFDIR \"${CMAKE_INSTALL_PREFIX}/etc\"
-#define LIBDIR \"${CMAKE_INSTALL_PREFIX}/lib\"
-#define BINDIR \"${CMAKE_INSTALL_PREFIX}/bin\"
-#define LOCALE_DATADIRNAME \"share\"
-")
+SET(prefix ${CMAKE_INSTALL_PREFIX})
+SET(datadir ${DATADIR})
+SET(bindir ${BINDIR})
+SET(libdir ${LIBDIR})
+SET(sysconfdir ${SYSCONFDIR})
+GNC_CONFIGURE(gncla-dir.h.in gncla-dir.h)
+
+### Create gnc-version.h ###
 
-# Workaround to create a simple gnc-version.h file
-FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-version.h "
-/* Autogenerated. Do not change. */
+SET (GNC_VERSION_H_IN
+"/* Autogenerated. Do not change. */
 #ifndef GNC_VERSION_H
 #define GNC_VERSION_H
 
-#define GNUCASH_SVN 1
-#define GNUCASH_BUILD_DATE \"2010-XX-XX\"
-#define GNUCASH_SVN_REV \"xxxxxxx\"
+#define GNUCASH_SCM \"git\"
+#define GNUCASH_BUILD_DATE \"@GNUCASH_BUILD_DATE@\"
+#include \"gnc-vcs-info.h\"
 #endif
 ")
 
-SET (libgnc_core_utils_HEADERS
+STRING(TIMESTAMP GNUCASH_BUILD_DATE "%Y-%m-%d")
+
+STRING(CONFIGURE ${GNC_VERSION_H_IN} GNC_VERSION_H_CONTENT)
+
+FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-version.h ${GNC_VERSION_H_CONTENT})
+
+### Create gnc-vcs-info.h
+# The meta-cmake gymnastics here come from https://cmake.org/pipermail/cmake/2010-July/038015.html
+
+FIND_PACKAGE(Git)
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+   "/* Autogenerated. Do not change. */\n#define GNUCASH_SCM_REV \"@GNUCASH_SCM_REV@\"\n"
+)
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
+  "EXECUTE_PROCESS(
+    COMMAND ${GIT_EXECUTABLE} --git-dir ${CMAKE_SOURCE_DIR}/.git log -1 --pretty=format:%h HEAD
+    OUTPUT_VARIABLE GNUCASH_SCM_REV
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+  )
+  CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
+")
+
+ADD_CUSTOM_TARGET(gnc-vcs-info ALL
+  ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+                   -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+                   -P ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
+)
+
+### Compile library
+
+SET(core_utils_noinst_HEADERS
   binreloc.h
   gnc-prefs.h
   gnc-prefs-p.h
+  gnc-environment.h
   gnc-features.h
   gnc-filepath-utils.h
   gnc-gdate-utils.h
@@ -84,7 +104,52 @@ SET (libgnc_core_utils_HEADERS
   gnc-uri-utils.h
 )
 
-ADD_LIBRARY	(core-utils
-  ${libgnc_core_utils_SOURCES}
-  ${libgnc_core_utils_HEADERS}
-  )
+ADD_LIBRARY	(gnc-core-utils
+  ${core_utils_SOURCES}
+  ${core_utils_noinst_HEADERS}
+)
+ADD_DEPENDENCIES(gnc-core-utils gnc-vcs-info)
+
+TARGET_LINK_LIBRARIES(gnc-core-utils gnc-qof ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gnc-core-utils
+    PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER})
+
+TARGET_INCLUDE_DIRECTORIES(gnc-core-utils PUBLIC
+  ${CMAKE_CURRENT_BINARY_DIR} # for headers generated in core-utils build directory
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${GUILE_INCLUDE_DIRS}
+  ${GTK_MAC_INCLUDE_DIRS}
+)
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gnc-core-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  TARGET_LINK_LIBRARIES(gnc-core-utils ${OSX_EXTRA_LIBRARIES})
+ENDIF(MAC_INTEGRATION)
+
+INSTALL(TARGETS gnc-core-utils
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# Scheme
+
+SET (core_utils_SCHEME core-utils.scm)
+
+SET(GUILE_OUTPUT_DIR   gnucash)
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    src/core-utils)
+SET(GUILE_LIBRARY_DIRS src/core-utils)
+SET(GUILE_DEPENDS      gnc-core-utils)
+
+GNC_ADD_SCHEME_TARGETS(scm-core-utils
+    "${core_utils_SCHEME}"
+    ${GUILE_OUTPUT_DIR}
+    "${GUILE_MODULES}"
+    "${GUILE_LOAD_DIRS}"
+    "${GUILE_LIBRARY_DIRS}"
+    "${GUILE_DEPENDS}"
+    FALSE
+)
+
diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt
index 26c7723..051c424 100644
--- a/src/engine/CMakeLists.txt
+++ b/src/engine/CMakeLists.txt
@@ -1,21 +1,20 @@
 # CMakeLists.txt for src/engine
 
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.engine\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for pow.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof) # for qof.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-module.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # for <Account.h>
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) # for iso-4217-currencies.c
-
-SET (libgncmod_engine_HEADERS
+SET(engine_noinst_HEADERS
+  AccountP.h
+  ScrubP.h
+  SplitP.h
+  SX-book.h
+  SX-ttinfo.h
+  TransactionP.h
+  gnc-hooks-scm.h
+  gnc-lot.h
+  gnc-lot-p.h
+  gnc-pricedb-p.h
+  policy-p.h
+)
+
+SET (engine_HEADERS
   Account.h
   FreqSpec.h
   Recurrence.h
@@ -25,6 +24,7 @@ SET (libgncmod_engine_HEADERS
   Query.h
   Scrub.h
   Scrub2.h
+  ScrubBusiness.h
   Scrub3.h
   Split.h
   TransLog.h
@@ -32,6 +32,7 @@ SET (libgncmod_engine_HEADERS
   cap-gains.h
   cashobjects.h
   engine-helpers.h
+  engine-helpers-guile.h
   glib-helpers.h
   gnc-budget.h
   gnc-commodity.h
@@ -54,6 +55,7 @@ SET (libgncmod_engine_HEADERS
   gncEmployeeP.h
   gncEntry.h
   gncEntryP.h
+  gncIDSearch.h
   gncInvoice.h
   gncInvoiceP.h
   gncJob.h
@@ -70,7 +72,7 @@ SET (libgncmod_engine_HEADERS
 
 # Command to generate the swig-engine.c wrapper file
 SET (SWIG_ENGINE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-engine.c)
-GNC_ADD_SWIG_COMMAND (${SWIG_ENGINE_C} ${CMAKE_CURRENT_SOURCE_DIR}/engine.i ${libgncmod_engine_HEADERS})
+GNC_ADD_SWIG_COMMAND (${SWIG_ENGINE_C} ${CMAKE_CURRENT_SOURCE_DIR}/engine.i ${engine_HEADERS})
 
 # Command to generate the iso-4217-currencies.c file
 SET (ISO_4217_C ${CMAKE_CURRENT_BINARY_DIR}/iso-4217-currencies.c)
@@ -78,15 +80,18 @@ ADD_CUSTOM_COMMAND (
   OUTPUT ${ISO_4217_C}
   DEPENDS iso-4217-currencies.xml iso-currencies-to-c.xsl
   COMMAND
-    ${XSLTPROC} -o ${ISO_4217_C} "${CMAKE_CURRENT_SOURCE_DIR}/iso-currencies-to-c.xsl" "${CMAKE_CURRENT_SOURCE_DIR}/iso-4217-currencies.xml"
+    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${ISO_4217_C} "${CMAKE_CURRENT_SOURCE_DIR}/iso-currencies-to-c.xsl" "${CMAKE_CURRENT_SOURCE_DIR}/iso-4217-currencies.xml"
 )
 # Add dependency on iso-4217-currencies.c
-SET_SOURCE_FILES_PROPERTIES (gnc-commodity.c PROPERTIES OBJECT_DEPENDS ${ISO_4217_C})
+SET_SOURCE_FILES_PROPERTIES (gnc-commodity.c PROPERTIES OBJECT_DEPENDS "${ISO_4217_C};${CONFIG_H}")
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${libgncmod_engine_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
 # Add dependency on swig-runtime.h
-SET_SOURCE_FILES_PROPERTIES (gnc-hooks.c engine-helpers.c kvp-scm.c glib-helpers.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
+SET_SOURCE_FILES_PROPERTIES (gnc-hooks.c engine-helpers.c kvp-scm.cpp glib-helpers.c PROPERTIES OBJECT_DEPENDS "${CONFIG_H};${SWIG_RUNTIME_H}")
 
-SET (libgncmod_engine_SOURCES
+SET (engine_SOURCES
   Account.c
   Recurrence.c
   Query.c
@@ -96,6 +101,7 @@ SET (libgncmod_engine_SOURCES
   Scrub.c
   Scrub2.c
   Scrub3.c
+  ScrubBusiness.c
   Split.c
   TransLog.c
   Transaction.c
@@ -118,9 +124,11 @@ SET (libgncmod_engine_SOURCES
   gncAddress.c
   gncBillTerm.c
   gncBusGuile.c
+  gncBusiness.c
   gncCustomer.c
   gncEmployee.c
   gncEntry.c
+  gncIDSearch.c
   gncInvoice.c
   gncJob.c
   gncOrder.c
@@ -129,10 +137,74 @@ SET (libgncmod_engine_SOURCES
   gncVendor.c
 )
 
-# Add dependency on config.h
-#SET_SOURCE_FILES_PROPERTIES (${libgncmod_engine_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
-ADD_LIBRARY	(engine
-  ${libgncmod_engine_SOURCES}
-  ${libgncmod_engine_HEADERS}
-  )
+ADD_LIBRARY	(gncmod-engine
+  ${engine_SOURCES}
+  ${engine_HEADERS}
+  ${engine_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-engine gnc-core-utils gnc-module gnc-qof ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-engine PRIVATE -DG_LOG_DOMAIN=\"gnc.engine\")
+
+TARGET_INCLUDE_DIRECTORIES (gncmod-engine
+    PRIVATE ${CMAKE_CURRENT_BINARY_DIR} # for iso-4217-currencies.c
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+INSTALL(TARGETS gncmod-engine
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${engine_HEADERS} DESTINATION include/gnucash)
+
+# Scheme
+
+SET (engine_SCHEME_0
+    engine.scm
+    business-core.scm
+)
+
+SET (engine_SCHEME_1
+    commodity-table.scm
+    engine-interface.scm
+    engine-utilities.scm
+    gnc-numeric.scm
+)
+
+SET(BACKEND_DEPENDS gncmod-backend-xml-link)
+
+
+IF(WITH_SQL)
+  LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi-link)
+ENDIF(WITH_SQL)
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    src/gnc-module)
+SET(GUILE_LIBRARY_DIRS src/gnc-module)
+SET(GUILE_DEPENDS      ${BACKEND_DEPENDS} gnc-module gncmod-engine scm-gnc-module)
+
+
+GNC_ADD_SCHEME_TARGETS(scm-engine-0
+  "${engine_SCHEME_0}"
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-engine-1
+  "${engine_SCHEME_1}"
+  ""
+  ""
+  ""
+  ""
+  "scm-engine-0;${GUILE_DEPENDS}"
+  FALSE
+)
+
+ADD_CUSTOM_TARGET(scm-engine ALL DEPENDS scm-engine-1 scm-engine-0)
diff --git a/src/gnc-module/CMakeLists.txt b/src/gnc-module/CMakeLists.txt
index be5ec37..d06f982 100644
--- a/src/gnc-module/CMakeLists.txt
+++ b/src/gnc-module/CMakeLists.txt
@@ -1,33 +1,59 @@
 # CMakeLists.txt for src/gnc-module
 
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.module\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR}) # when building swig-gnc-module.c
-
 # Command to generate the swig-engine.c wrapper file
 SET (SWIG_GNC_MODULE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnc-module.c)
 GNC_ADD_SWIG_COMMAND (${SWIG_GNC_MODULE_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnc-module.i)
 
-SET (libgnc_module_SOURCES
+SET (gnc_module_SOURCES
   gnc-module.c
   ${SWIG_GNC_MODULE_C}
 )
 
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_module_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${gnc_module_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
-SET (libgnc_module_HEADERS
+SET (gnc_module_HEADERS
   gnc-module.h
   gnc-module-api.h
 )
 
 ADD_LIBRARY	(gnc-module
-  ${libgnc_module_SOURCES}
-  ${libgnc_module_HEADERS}
-  )
+  ${gnc_module_SOURCES}
+  ${gnc_module_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gnc-module gnc-qof ${GUILE_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gnc-module PRIVATE -DG_LOG_DOMAIN=\"gnc.module\")
+
+TARGET_INCLUDE_DIRECTORIES (gnc-module
+    PRIVATE ${GUILE_INCLUDE_DIRS}
+    PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+INSTALL(TARGETS gnc-module
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${gnc_module_HEADERS} DESTINATION include/gnucash)
+
+# --- Compile Scheme file(s) ---
+
+SET (gnc_module_SCHEME gnc-module.scm)
+
+SET(GUILE_OUTPUT_DIR   gnucash)
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    "")
+SET(GUILE_LIBRARY_DIRS "")
+SET(GUILE_DEPENDS      gnc-module)
+
+GNC_ADD_SCHEME_TARGETS(scm-gnc-module
+  "${gnc_module_SCHEME}"
+  ${GUILE_OUTPUT_DIR} 
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
diff --git a/src/gnome-search/CMakeLists.txt b/src/gnome-search/CMakeLists.txt
new file mode 100644
index 0000000..bad46c5
--- /dev/null
+++ b/src/gnome-search/CMakeLists.txt
@@ -0,0 +1,60 @@
+
+SET (gnome_search_SOURCES
+  gncmod-gnome-search.c
+  gnc-general-search.c
+  dialog-search.c
+  search-account.c
+  search-boolean.c
+  search-core-type.c
+  search-core-utils.c
+  search-date.c
+  search-double.c
+  search-int64.c
+  search-numeric.c
+  search-reconciled.c
+  search-string.c
+)
+
+SET (gnome_search_HEADERS
+  dialog-search.h
+  gnc-general-search.h
+)
+
+SET (gnome_search_noinst_HEADERS
+  search-account.h
+  search-boolean.h
+  search-core-type.h
+  search-core-utils.h
+  search-date.h
+  search-double.h
+  search-int64.h
+  search-numeric.h
+  search-reconciled.h
+  search-string.h
+)  
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${gnome_search_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY (gncmod-gnome-search
+    ${gnome_search_SOURCES}
+    ${gnome_search_HEADERS}
+    ${gnome_search_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-gnome-search gnc-qof gncmod-gnome-utils ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-gnome-search PRIVATE -DG_LOG_DOMAIN=\"gnc.gui.search\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-gnome-search PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gncmod-gnome-search
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${gnome_search_HEADERS} DESTINATION include/gnucash)
+
+SET(gnome_search_GLADE dialog-search.glade)
+
+INSTALL(FILES ${gnome_search_GLADE} DESTINATION share/gnucash/gtkbuilder)
diff --git a/src/gnome-utils/CMakeLists.txt b/src/gnome-utils/CMakeLists.txt
new file mode 100644
index 0000000..73f6390
--- /dev/null
+++ b/src/gnome-utils/CMakeLists.txt
@@ -0,0 +1,264 @@
+# Note that src/gnome-utils CANNOT depend on src/gnome!
+
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET (SWIG_GNOME_UTILS_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnome-utils.c)
+GNC_ADD_SWIG_COMMAND (${SWIG_GNOME_UTILS_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnome-utils.i)
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/gschemas/org.gnucash.warnings.gschema.xml.in.in
+               ${CMAKE_CURRENT_BINARY_DIR}/gschemas/org.gnucash.warnings.gschema.xml.in)
+
+SET (WARNINGS_SCHEMA gschemas/org.gnucash.warnings.gschema.xml.in)
+SET (GNC_WARNINGS_C ${CMAKE_CURRENT_BINARY_DIR}/gnc-warnings.c)
+SET (GNC_WARNINGS_H ${CMAKE_CURRENT_BINARY_DIR}/gnc-warnings.h)
+
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${GNC_WARNINGS_C}
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA} make-gnc-warnings-c.xsl
+  COMMAND
+    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${GNC_WARNINGS_C} ${CMAKE_CURRENT_SOURCE_DIR}/make-gnc-warnings-c.xsl ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA}
+)
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${GNC_WARNINGS_H}
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA} make-gnc-warnings-h.xsl
+  COMMAND
+    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${GNC_WARNINGS_H} ${CMAKE_CURRENT_SOURCE_DIR}/make-gnc-warnings-h.xsl ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA}
+)
+
+SET (gnome_utils_SOURCES
+  account-quickfill.c
+  assistant-xml-encoding.c
+  cursors.c
+  dialog-account.c
+  dialog-book-close.c
+  dialog-commodity.c
+  dialog-dup-trans.c
+  dialog-file-access.c
+  dialog-object-references.c
+  dialog-options.c
+  dialog-preferences.c
+  dialog-query-view.c
+  dialog-reset-warnings.c
+  dialog-tax-table.c
+  dialog-totd.c
+  dialog-transfer.c
+  dialog-userpass.c
+  dialog-utils.c
+  gnc-account-sel.c
+  gnc-amount-edit.c
+  gnc-autosave.c
+  gnc-cell-renderer-date.c
+  gnc-cell-renderer-popup.c
+  gnc-cell-renderer-popup-entry.c
+  gnc-combott.c
+  gnc-commodity-edit.c
+  gnc-currency-edit.c
+  gnc-date-delta.c
+  gnc-date-edit.c
+  gnc-date-format.c 
+  gnc-dense-cal.c
+  gnc-dense-cal-model.c
+  gnc-dense-cal-store.c
+  gnc-embedded-window.c
+  gnc-file.c
+  gnc-frequency.c
+  gnc-recurrence.c
+  gnc-general-select.c
+  gnc-gnome-utils.c
+  gnc-gobject-utils.c
+  gnc-gtk-utils.c
+  gnc-gui-query.c
+  gnc-icons.c
+  gnc-keyring.c
+  gnc-main-window.c
+  gnc-menu-extensions.c
+  gnc-plugin-file-history.c
+  gnc-plugin-manager.c
+  gnc-plugin-menu-additions.c
+  gnc-plugin-page.c
+  gnc-plugin.c
+  gnc-period-select.c
+  gnc-query-view.c
+  gnc-splash.c
+  gnc-sx-instance-dense-cal-adapter.c
+  gnc-sx-list-tree-model-adapter.c
+  gnc-tree-control-split-reg.c
+  gnc-tree-model.c
+  gnc-tree-model-account-types.c
+  gnc-tree-model-account.c
+  gnc-tree-model-budget.c
+  gnc-tree-model-owner.c
+  gnc-tree-model-commodity.c
+  gnc-tree-model-price.c
+  gnc-tree-model-split-reg.c
+  gnc-tree-util-split-reg.c
+  gnc-tree-view-account.c
+  gnc-tree-view-commodity.c
+  gnc-tree-view-owner.c
+  gnc-tree-view-price.c
+  gnc-tree-view-split-reg.c
+  gnc-tree-view-sx-list.c
+  gnc-tree-view.c
+  ${GNC_WARNINGS_C}
+  gnc-window.c
+  gncmod-gnome-utils.c
+  misc-gnome-utils.c
+  tree-view-utils.c
+  search-param.c
+  print-session.c
+  ${SWIG_GNOME_UTILS_C}
+  swig-gnome-utils.c
+  window-main-summarybar.c
+)
+
+SET(gnome_utils_noinst_HEADERS
+  dialog-tax-table.h
+  gnc-autosave.h
+  gnc-gobject-utils.h
+  gnc-gtk-utils.h
+  search-param.h
+  ${GNC_WARNINGS_H}
+)
+
+SET (gnome_utils_HEADERS
+  account-quickfill.h
+  assistant-xml-encoding.h
+  dialog-account.h
+  dialog-book-close.h
+  dialog-commodity.h
+  dialog-dup-trans.h
+  dialog-file-access.h
+  dialog-preferences.h
+  dialog-object-references.h
+  dialog-options.h
+  dialog-query-view.h
+  dialog-reset-warnings.h
+  dialog-totd.h
+  dialog-transfer.h
+  dialog-utils.h
+  gnc-account-sel.h
+  gnc-amount-edit.h
+  gnc-cell-renderer-date.h
+  gnc-cell-renderer-popup.h
+  gnc-cell-renderer-popup-entry.h
+  gnc-combott.h
+  gnc-commodity-edit.h
+  gnc-currency-edit.h
+  gnc-date-delta.h
+  gnc-date-edit.h
+  gnc-date-format.h
+  gnc-dense-cal.h
+  gnc-dense-cal-model.h
+  gnc-dense-cal-store.h
+  gnc-embedded-window.h
+  gnc-file.h
+  gnc-frequency.h
+  gnc-recurrence.h
+  gnc-general-select.h
+  gnc-gnome-utils.h
+  gnc-gui-query.h
+  gnc-icons.h
+  gnc-keyring.h
+  gnc-main-window.h
+  gnc-menu-extensions.h
+  gnc-plugin-file-history.h
+  gnc-plugin-manager.h
+  gnc-plugin-menu-additions.h
+  gnc-plugin-page.h
+  gnc-plugin.h
+  gnc-period-select.h
+  gnc-query-view.h
+  gnc-splash.h
+  gnc-sx-instance-dense-cal-adapter.h
+  gnc-sx-list-tree-model-adapter.h
+  gnc-tree-control-split-reg.h
+  gnc-tree-model.h
+  gnc-tree-model-account-types.h
+  gnc-tree-model-account.h
+  gnc-tree-model-budget.h
+  gnc-tree-model-owner.h
+  gnc-tree-model-commodity.h
+  gnc-tree-model-price.h
+  gnc-tree-model-split-reg.h
+  gnc-tree-util-split-reg.h
+  gnc-tree-view-account.h
+  gnc-tree-view-commodity.h
+  gnc-tree-view-owner.h
+  gnc-tree-view-price.h
+  gnc-tree-view-split-reg.h
+  gnc-tree-view-sx-list.h
+  gnc-tree-view.h
+  gnc-ui.h
+  gnc-window.h
+  misc-gnome-utils.h
+  tree-view-utils.h
+  print-session.h
+  window-main-summarybar.h
+)
+
+ADD_LIBRARY (gncmod-gnome-utils
+  ${gnome_utils_SOURCES}
+  ${gnome_utils_HEADERS}
+  ${gnome_utils_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-gnome-utils gncmod-app-utils gncmod-engine gnc-backend-xml-utils
+     ${GTK2_LDFLAGS} ${GTK_MAC_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-gnome-utils PUBLIC ${GTK_MAC_CFLAGS_OTHER}
+    PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\")
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gncmod-gnome-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  TARGET_LINK_LIBRARIES(gncmod-gnome-utils ${OSX_EXTRA_LIBRARIES})
+ENDIF(MAC_INTEGRATION)
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-gnome-utils
+    PUBLIC
+      ${GTK2_INCLUDE_DIRS}
+      ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE
+      ${GTK_MAC_INCLUDE_DIRS}
+      ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+INSTALL(TARGETS gncmod-gnome-utils
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${gnome_utils_HEADERS} DESTINATION include/gnucash)
+
+
+# Scheme
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    src/core-utils src/gnc-module src/scm)
+SET(GUILE_LIBRARY_DIRS src/core-utils src/gnc-module)
+SET(GUILE_DEPENDS      gncmod-gnome-utils scm-core-utils scm-gnc-module scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-1
+  gnome-utils.scm
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+
+GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-2
+  gnc-menu-extensions.scm
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+ADD_CUSTOM_TARGET(scm-gnome-utils ALL DEPENDS scm-gnome-utils-2 scm-gnome-utils-1)
\ No newline at end of file
diff --git a/src/gnome-utils/gschemas/CMakeLists.txt b/src/gnome-utils/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..376767d
--- /dev/null
+++ b/src/gnome-utils/gschemas/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+SET(gnome_utils_GSCHEMA org.gnucash.history.gschema.xml org.gnucash.warnings.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(gnome-utils-gschema "${gnome_utils_GSCHEMA}")
\ No newline at end of file
diff --git a/src/gnome-utils/gtkbuilder/CMakeLists.txt b/src/gnome-utils/gtkbuilder/CMakeLists.txt
new file mode 100644
index 0000000..168e5c2
--- /dev/null
+++ b/src/gnome-utils/gtkbuilder/CMakeLists.txt
@@ -0,0 +1,11 @@
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/gnome-utils/ui/CMakeLists.txt b/src/gnome-utils/ui/CMakeLists.txt
new file mode 100644
index 0000000..6c9019d
--- /dev/null
+++ b/src/gnome-utils/ui/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/gnome/CMakeLists.txt b/src/gnome/CMakeLists.txt
new file mode 100644
index 0000000..cd8cc47
--- /dev/null
+++ b/src/gnome/CMakeLists.txt
@@ -0,0 +1,149 @@
+
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET (gnc_gnome_noinst_HEADERS
+  assistant-acct-period.h
+  assistant-hierarchy.h
+  assistant-loan.h
+  assistant-stock-split.h
+  dialog-fincalc.h
+  dialog-find-transactions.h
+  dialog-find-transactions2.h
+  dialog-lot-viewer.h
+  dialog-new-user.h
+  dialog-print-check.h
+  dialog-print-check2.h
+  dialog-progress.h
+  dialog-sx-editor.h
+  dialog-sx-editor2.h
+  dialog-sx-from-trans.h
+  dialog-sx-since-last-run.h
+  gnc-budget-view.h
+  gnc-plugin-account-tree.h
+  gnc-plugin-basic-commands.h
+  gnc-plugin-budget.h
+  gnc-plugin-register.h
+  gnc-plugin-register2.h
+  gnc-plugin-page-account-tree.h
+  gnc-plugin-page-budget.h
+  gnc-plugin-page-sx-list.h
+  gnc-plugin-page-register.h
+  gnc-plugin-page-register2.h
+  gnc-split-reg.h
+  gnc-split-reg2.h
+  reconcile-view.h
+  top-level.h
+  window-reconcile.h
+  window-reconcile2.h
+  window-autoclear.h
+)
+
+SET (SWIG_GNOME_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnome.c)
+GNC_ADD_SWIG_COMMAND (${SWIG_GNOME_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnome.i ${gnc_gnome_HEADERS})
+
+SET (gnc_gnome_SOURCES 
+  ${SWIG_GNOME_C}
+  assistant-acct-period.c
+  assistant-hierarchy.c
+  assistant-loan.c
+  assistant-stock-split.c
+  dialog-commodities.c
+  dialog-fincalc.c
+  dialog-find-transactions.c
+  dialog-find-transactions2.c
+  dialog-lot-viewer.c
+  dialog-new-user.c
+  dialog-price-editor.c
+  dialog-price-edit-db.c
+  dialog-print-check.c
+  dialog-print-check2.c
+  dialog-progress.c
+  dialog-sx-editor.c
+  dialog-sx-editor2.c
+  dialog-sx-from-trans.c
+  dialog-sx-since-last-run.c
+  dialog-tax-info.c
+  gnc-budget-view.c
+  gnc-plugin-account-tree.c
+  gnc-plugin-basic-commands.c
+  gnc-plugin-budget.c
+  gnc-plugin-register.c
+  gnc-plugin-register2.c
+  gnc-plugin-page-account-tree.c
+  gnc-plugin-page-budget.c
+  gnc-plugin-page-sx-list.c
+  gnc-plugin-page-register.c
+  gnc-plugin-page-register2.c
+  gnc-split-reg.c
+  gnc-split-reg2.c
+  reconcile-view.c
+  top-level.c
+  window-reconcile.c
+  window-reconcile2.c
+  window-autoclear.c
+)  
+
+IF (WIN32)
+  SET (gnc_gnome_SOURCES ${gnc_gnome_SOURCES} ${CMAKE_SOURCE_DIR}/lib/libc/strfmon.c)
+ENDIF(WIN32)
+
+ADD_LIBRARY (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gnc-gnome gncmod-gnome-search gncmod-ledger-core gncmod-report-gnome gncmod-report-system
+    gncmod-register-gnome gncmod-register-core gncmod-engine ${GTK2_LDFLAGS} ${GTK_MAC_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gnc-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\" ${GTK_MAC_CFLAGS_OTHER})
+
+TARGET_INCLUDE_DIRECTORIES(gnc-gnome
+  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${CMAKE_SOURCE_DIR}/src/app-utils/calculation ${GTK_MAC_INCLUDE_DIRS}
+)
+
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gnc-gnome PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  TARGET_LINK_LIBRARIES(gnc-gnome ${OSX_EXTRA_LIBRARIES})
+ENDIF(MAC_INTEGRATION)
+
+
+INSTALL(TARGETS gnc-gnome
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+
+# No headers to install
+
+# FIXME: where does LC_ALL=C come from?
+
+ADD_CUSTOM_COMMAND(
+    OUTPUT gnucash.appdata.xml
+    COMMAND ${CMAKE_COMMAND} -E env
+      LC_ALL=C
+      ${PERL_EXECUTABLE} ${INTLTOOL_MERGE} -x -u -c ${CMAKE_SOURCE_DIR}/po/.intltool-merge-cache ${CMAKE_SOURCE_DIR}/po
+        ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in gnucash.appdata.xml
+    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
+)
+
+ADD_CUSTOM_TARGET(gnucash-appdata ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml DESTINATION share/appdata)
+
+#=======
+
+CONFIGURE_FILE(gnucash.desktop.in.in gnucash.desktop.in)
+
+
+ADD_CUSTOM_COMMAND(
+    OUTPUT gnucash.desktop
+    COMMAND ${CMAKE_COMMAND} -E env
+      LC_ALL=C
+      ${PERL_EXECUTABLE} ${INTLTOOL_MERGE} -d -u -c ${CMAKE_SOURCE_DIR}/po/.intltool-merge-cache ${CMAKE_SOURCE_DIR}/po
+        gnucash.desktop.in gnucash.desktop
+    MAIN_DEPENDENCY gnucash.desktop.in
+)
+
+ADD_CUSTOM_TARGET(gnucash-desktop ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION share/applications)
diff --git a/src/gnome/gschemas/CMakeLists.txt b/src/gnome/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..b0ff4a1
--- /dev/null
+++ b/src/gnome/gschemas/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+SET(gnome_GSCHEMA
+  org.gnucash.dialogs.gschema.xml
+  org.gnucash.dialogs.commodities.gschema.xml
+  org.gnucash.dialogs.checkprinting.gschema.xml
+  org.gnucash.dialogs.reconcile.gschema.xml
+  org.gnucash.dialogs.sxs.gschema.xml
+  org.gnucash.dialogs.totd.gschema.xml
+  org.gnucash.gschema.xml
+  org.gnucash.window.pages.account.tree.gschema.xml
+  org.gnucash.window.pages.gschema.xml
+)
+
+# If you edit one of the above files, you need to rerun cmake.
+# When we can use CONFIGURE_FILE() instead of GNC_CONFIGURE()
+# this issue will go away.
+
+
+ADD_GSCHEMA_TARGETS(gnome-gschema "${gnome_GSCHEMA}")
\ No newline at end of file
diff --git a/src/gnome/gtkbuilder/CMakeLists.txt b/src/gnome/gtkbuilder/CMakeLists.txt
new file mode 100644
index 0000000..025e0bf
--- /dev/null
+++ b/src/gnome/gtkbuilder/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        DESTINATION share/gnucash
+        PATTERN Makefile.* EXCLUDE
+        PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/gnome/ui/CMakeLists.txt b/src/gnome/ui/CMakeLists.txt
new file mode 100644
index 0000000..84f2356
--- /dev/null
+++ b/src/gnome/ui/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+          DESTINATION ${DATADIR_BUILD}/gnucash/ui
+          PATTERN Makefile.* EXCLUDE
+          PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/html/CMakeLists.txt b/src/html/CMakeLists.txt
new file mode 100644
index 0000000..1e2f3fa
--- /dev/null
+++ b/src/html/CMakeLists.txt
@@ -0,0 +1,43 @@
+
+SET (html_HEADERS
+  gnc-html-history.h
+  gnc-html.h
+  gnc-html-p.h
+  gnc-html-factory.h
+  gnc-html-webkit.h
+  gnc-html-extras.h
+  gnc-html-webkit-p.h
+)
+
+SET (SWIG_GNC_HTML_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnc-html.c)
+GNC_ADD_SWIG_COMMAND (${SWIG_GNC_HTML_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnc-html.i ${gncmod_html_HEADERS})  
+
+SET (html_SOURCES
+  gncmod-html.c
+  gnc-html.c
+  gnc-html-history.c
+  gnc-html-factory.c
+  gnc-html-webkit.c
+  ${SWIG_GNC_HTML_C}
+)
+
+ADD_LIBRARY (gncmod-html
+  ${html_SOURCES}
+  ${html_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-html gnc-qof gnc-module gncmod-gnome-utils ${WEBKIT_LDFLAGS} ${GUILE_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-html PRIVATE -DG_LOG_DOMAIN=\"gnc.html\")
+
+
+TARGET_INCLUDE_DIRECTORIES (gncmod-html
+    PUBLIC ${WEBKIT_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+INSTALL(TARGETS gncmod-html
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${html_HEADERS} DESTINATION include/gnucash)
\ No newline at end of file
diff --git a/src/import-export/CMakeLists.txt b/src/import-export/CMakeLists.txt
index 5f93071..55c7fad 100644
--- a/src/import-export/CMakeLists.txt
+++ b/src/import-export/CMakeLists.txt
@@ -1,43 +1,77 @@
 # CMakeLists.txt for src/import-export
 
 # ############################################################
-
 IF (WITH_AQBANKING)
-  ADD_SUBDIRECTORY (aqb)
-ENDIF (WITH_AQBANKING)
-
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.import\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GCONF2_INCLUDE_DIRS})
-#INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-#INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for pow.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof) # for qof.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-module.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/app-utils)
-
-SET (libgnc_import_SOURCES
+  ADD_SUBDIRECTORY(aqb)
+ENDIF(WITH_AQBANKING)
+ADD_SUBDIRECTORY(csv-exp)
+ADD_SUBDIRECTORY(csv-imp)
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(log-replay)
+IF (WITH_OFX)
+  ADD_SUBDIRECTORY(ofx)
+ENDIF(WITH_OFX)
+ADD_SUBDIRECTORY(qif)
+ADD_SUBDIRECTORY(qif-imp)
+
+
+SET (generic_import_SOURCES
+  import-account-matcher.c
+  import-commodity-matcher.c
+  import-backend.c
+  import-format-dialog.c
+  import-match-picker.c
+  import-parse.c
   import-utilities.c
   import-settings.c
-  import-match-map.c
+  import-main-matcher.c
+  gncmod-generic-import.c
 )
 
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${generic_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
-SET (libgnc_import_HEADERS
-  import-utilities.h
+SET (generic_import_HEADERS
+  import-parse.h
+)
+
+SET (generic_import_noinst_HEADERS
+  import-account-matcher.h
+  import-backend.h
+  import-commodity-matcher.h
+  import-main-matcher.h
+  import-match-picker.h
   import-settings.h
-  import-match-map.h
+  import-utilities.h
+)
+
+ADD_LIBRARY (gncmod-generic-import
+  ${generic_import_SOURCES}
+  ${generic_import_HEADERS}
+  ${generic_import_noinst_HEADERS}
 )
 
-ADD_LIBRARY (gnc-import
-  ${libgnc_import_SOURCES}
-  ${libgnc_import_HEADERS}
-  )
+TARGET_LINK_LIBRARIES(gncmod-generic-import gncmod-gnome-utils gncmod-engine ${GTK2_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-generic-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-generic-import PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+
+INSTALL(TARGETS gncmod-generic-import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin
+)
+
+INSTALL(FILES ${generic_import_HEADERS} DESTINATION include/gnucash)
+
+SET(generic_import_GLADE dialog-import.glade)
+
+INSTALL(FILES ${generic_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
 
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${generic_import_GLADE}
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+ENDIF()
diff --git a/src/import-export/aqb/CMakeLists.txt b/src/import-export/aqb/CMakeLists.txt
index 2957afb..9aa5902 100644
--- a/src/import-export/aqb/CMakeLists.txt
+++ b/src/import-export/aqb/CMakeLists.txt
@@ -1,41 +1,76 @@
 # CMakeLists.txt for src/import-export/aqbanking
 
-# ############################################################
-
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.import.aqbanking\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GCONF2_INCLUDE_DIRS})
-#INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-#INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-#INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GWENHYWFAR_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${AQBANKING_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for pow.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof) # for qof.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-module.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/app-utils)
-
-SET (libgnc_aqbanking_SOURCES
+ADD_SUBDIRECTORY(gschemas)
+
+
+SET (aqbanking_SOURCES
+  dialog-ab-trans.c
+  dialog-ab-daterange.c
+  assistant-ab-initial.c
+  gnc-ab-getbalance.c
+  gnc-ab-gettrans.c
   gnc-ab-kvp.c
-#  gnc-ab-utils.c
-#  gnc-gwen-gui.c
+  gnc-ab-transfer.c
+  gnc-ab-utils.c
+  gnc-file-aqb-import.c
+  gnc-gwen-gui.c
+  gnc-plugin-aqbanking.c
+  gncmod-aqbanking.c
 )
 
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_aqbanking_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${aqbanking_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
-SET (libgnc_aqbanking_HEADERS
+SET (aqbanking_noinst_HEADERS
+  dialog-ab-trans.h
+  dialog-ab-daterange.h
+  assistant-ab-initial.h
+  gnc-ab-getbalance.h
+  gnc-ab-gettrans.h
   gnc-ab-kvp.h
-#  gnc-ab-utils.h
-#  gnc-gwen-gui.h
+  gnc-ab-transfer.h
+  gnc-ab-utils.h
+  gnc-file-aqb-import.h
+  gnc-gwen-gui.h
+  gnc-plugin-aqbanking.h
 )
 
-ADD_LIBRARY (gnc-aqbanking
-  ${libgnc_aqbanking_SOURCES}
-  ${libgnc_aqbanking_HEADERS}
+ADD_LIBRARY (gncmod-aqbanking
+  ${aqbanking_SOURCES}
+  ${aqbanking_noinst_HEADERS}
   )
+
+SET(AQB_EXPORT_SYMBOLS "")
+IF (WIN32)
+  SET(AQB_EXPORT_SYMBOLS "-Wl,--export-all-symbols")
+ENDIF()
+
+TARGET_LINK_LIBRARIES(gncmod-aqbanking gnc-gnome gncmod-gnome-utils gncmod-generic-import gncmod-register-core
+         gncmod-register-gnome gncmod-ledger-core gncmod-engine gnc-qof ${AQB_EXPORT_SYMBOLS} ${AQBANKING_LDFLAGS} ${GWENHYWFAR_LDFLAGS}
+         ${GWENGUI_GTK2_LDFLAGS} ${GNOME_LDFLAGS} ${KTOBLZCHECK_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-aqbanking PRIVATE -DG_LOG_DOMAIN=\"gnc.import.aqbanking\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-aqbanking PRIVATE ${AQBANKING_INCLUDE_DIRS}
+       ${GWENHYWFAR_INCLUDE_DIRS} ${KTOBLZCHECK_INCLUDE_DIRS})
+
+INSTALL(TARGETS gncmod-aqbanking
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+SET(aqbanking_GLADE assistant-ab-initial.glade dialog-ab.glade)
+
+SET(aqbanking_UI gnc-plugin-aqbanking-ui.xml)
+
+INSTALL(FILES ${aqbanking_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+INSTALL(FILES ${aqbanking_UI} DESTINATION share/gnucash/ui)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${aqbanking_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+  FILE(COPY ${aqbanking_GLADE}
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+ENDIF()
\ No newline at end of file
diff --git a/src/import-export/aqb/gschemas/CMakeLists.txt b/src/import-export/aqb/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..d2c036f
--- /dev/null
+++ b/src/import-export/aqb/gschemas/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+SET(aqb_GSCHEMA org.gnucash.dialogs.import.hbci.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(aqb-gschema "${aqb_GSCHEMA}")
\ No newline at end of file
diff --git a/src/import-export/csv-exp/CMakeLists.txt b/src/import-export/csv-exp/CMakeLists.txt
new file mode 100644
index 0000000..5926d59
--- /dev/null
+++ b/src/import-export/csv-exp/CMakeLists.txt
@@ -0,0 +1,47 @@
+ADD_SUBDIRECTORY(gschemas)
+
+SET(csv_export_SOURCES
+  gncmod-csv-export.c
+  gnc-plugin-csv-export.c
+  assistant-csv-export.c
+  csv-tree-export.c
+  csv-transactions-export.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${csv_export_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(csv_export_noinst_HEADERS
+  gnc-plugin-csv-export.h
+  assistant-csv-export.h
+  csv-tree-export.h
+  csv-transactions-export.h
+)
+
+ADD_LIBRARY(gncmod-csv-export ${csv_export_noinst_HEADERS} ${csv_export_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-csv-export gncmod-register-gnome gncmod-register-core gncmod-ledger-core gncmod-engine
+                         gnc-module gncmod-gnome-utils gnc-gnome gncmod-app-utils gnc-core-utils)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-csv-export PRIVATE -DG_LOG_DOMAIN=\"gnc.export.csv\")
+
+INSTALL(TARGETS gncmod-csv-export
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
+
+SET(csv_export_GLADE assistant-csv-export.glade)
+
+INSTALL(FILES ${csv_export_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+SET(csv_export_UI gnc-plugin-csv-export-ui.xml)
+
+INSTALL(FILES ${csv_export_UI} DESTINATION share/gnucash/ui)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${csv_export_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+  FILE(COPY ${csv_export_GLADE}
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+ENDIF()
\ No newline at end of file
diff --git a/src/import-export/csv-exp/gschemas/CMakeLists.txt b/src/import-export/csv-exp/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..95b32c0
--- /dev/null
+++ b/src/import-export/csv-exp/gschemas/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+SET(csv_exp_GSCHEMA org.gnucash.dialogs.export.csv.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(csv-exp-gschema "${csv_exp_GSCHEMA}")
+
diff --git a/src/import-export/csv-imp/CMakeLists.txt b/src/import-export/csv-imp/CMakeLists.txt
new file mode 100644
index 0000000..dc42986
--- /dev/null
+++ b/src/import-export/csv-imp/CMakeLists.txt
@@ -0,0 +1,68 @@
+ADD_SUBDIRECTORY(gschemas)
+
+SET(csv_import_SOURCES
+  gncmod-csv-import.c
+  assistant-csv-account-import.c
+  assistant-csv-fixed-trans-import.c
+  assistant-csv-trans-import.c
+  gnc-plugin-csv-import.c
+  csv-account-import.c
+  csv-fixed-trans-import.c
+  gnc-csv-account-map.c
+  gnc-csv-model.c
+  gnc-csv-gnumeric-popup.c
+  gnc-csv-trans-settings.c
+  ${CMAKE_SOURCE_DIR}/lib/stf/stf-parse.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${csv_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(csv_import_noinst_HEADERS
+  assistant-csv-account-import.h
+  assistant-csv-fixed-trans-import.h
+  assistant-csv-trans-import.h
+  gnc-plugin-csv-import.h
+  csv-account-import.h
+  csv-fixed-trans-import.h
+  gnc-csv-account-map.h
+  gnc-csv-model.h
+  gnc-csv-gnumeric-popup.h
+  gnc-csv-trans-settings.h
+  ${CMAKE_SOURCE_DIR}/lib/stf/stf-parse.h
+)
+
+ADD_LIBRARY(gncmod-csv-import ${csv_import_noinst_HEADERS} ${csv_import_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-csv-import ${GOFFICE_LDFLAGS} gncmod-generic-import gncmod-gnome-utils
+                 gncmod-app-utils gncmod-engine gnc-core-utils gnc-module)
+
+
+TARGET_COMPILE_DEFINITIONS(gncmod-csv-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.csv\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-csv-import PRIVATE
+     ${CMAKE_SOURCE_DIR}/lib ${GOFFICE_INCLUDE_DIRS}
+)
+
+INSTALL(TARGETS gncmod-csv-import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+# No headers to install
+
+SET(csv_import_GLADE assistant-csv-account-import.glade assistant-csv-fixed-trans-import.glade
+      assistant-csv-trans-import.glade)
+
+INSTALL(FILES ${csv_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+SET(csv_import_UI gnc-plugin-csv-import-ui.xml)
+
+INSTALL(FILES ${csv_import_UI} DESTINATION share/gnucash/ui)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${csv_import_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+  FILE(COPY ${csv_import_GLADE}
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+ENDIF()
diff --git a/src/import-export/csv-imp/gschemas/CMakeLists.txt b/src/import-export/csv-imp/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..3a7b23d
--- /dev/null
+++ b/src/import-export/csv-imp/gschemas/CMakeLists.txt
@@ -0,0 +1,3 @@
+SET(csv_imp_GSCHEMA org.gnucash.dialogs.import.csv.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(csv-imp-gschema "${csv_imp_GSCHEMA}")
\ No newline at end of file
diff --git a/src/import-export/gschemas/CMakeLists.txt b/src/import-export/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..958269e
--- /dev/null
+++ b/src/import-export/gschemas/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+SET(generic_import_GSCHEMA org.gnucash.dialogs.import.generic.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(generic-import-gschema "${generic_import_GSCHEMA}")
\ No newline at end of file
diff --git a/src/import-export/log-replay/CMakeLists.txt b/src/import-export/log-replay/CMakeLists.txt
new file mode 100644
index 0000000..5d72b84
--- /dev/null
+++ b/src/import-export/log-replay/CMakeLists.txt
@@ -0,0 +1,36 @@
+
+SET(log_replay_SOURCES
+  gnc-log-replay.c
+  gnc-plugin-log-replay.c
+  gncmod-log-replay.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${log_replay_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(log_replay_noinst_HEADERS
+  gnc-log-replay.h
+  gnc-plugin-log-replay.h
+)
+
+ADD_LIBRARY(gncmod-log-replay ${log_replay_SOURCES} ${log_replay_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-log-replay gncmod-gnome-utils gncmod-app-utils gncmod-engine
+     gnc-core-utils gnc-module gnc-qof ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-log-replay PRIVATE -DG_LOG_DOMAIN=\"gnc.import.log-replay\")
+
+INSTALL(TARGETS gncmod-log-replay
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
+
+SET(log_replay_UI gnc-plugin-log-replay-ui.xml)
+
+INSTALL(FILES ${log_replay_UI} DESTINATION share/gnucash/ui)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${log_replay_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+ENDIF()
\ No newline at end of file
diff --git a/src/import-export/ofx/CMakeLists.txt b/src/import-export/ofx/CMakeLists.txt
new file mode 100644
index 0000000..de0d7ed
--- /dev/null
+++ b/src/import-export/ofx/CMakeLists.txt
@@ -0,0 +1,41 @@
+ADD_SUBDIRECTORY(gschemas)
+
+SET(ofx_SOURCES
+  gnc-ofx-import.c
+  gnc-ofx-kvp.c
+  gncmod-ofx-import.c
+  gnc-plugin-ofx.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${ofx_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(ofx_noinst_HEADERS
+  gnc-ofx-import.h
+  gnc-ofx-kvp.h
+  gnc-plugin-ofx.h
+)
+
+ADD_LIBRARY(gncmod-ofx ${ofx_SOURCES} ${ofx_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-ofx gncmod-generic-import gncmod-engine gncmod-app-utils gnc-core-utils
+                    gncmod-gnome-utils gnc-qof ${LIBOFX_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-ofx PRIVATE -DG_LOG_DOMAIN=\"gnc.import.ofx\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-ofx PRIVATE ${LIBOFX_INCLUDE_DIRS})
+
+INSTALL(TARGETS gncmod-ofx
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+SET(ofx_UI gnc-plugin-ofx-ui.xml)
+
+INSTALL(FILES ${ofx_UI} DESTINATION share/gnucash/ui)
+
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${ofx_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+ENDIF()
\ No newline at end of file
diff --git a/src/import-export/ofx/gschemas/CMakeLists.txt b/src/import-export/ofx/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..9f143ad
--- /dev/null
+++ b/src/import-export/ofx/gschemas/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+set(ofx_GSCHEMA org.gnucash.dialogs.import.ofx.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(ofx-gschema "${ofx_GSCHEMA}")
diff --git a/src/import-export/qif-imp/CMakeLists.txt b/src/import-export/qif-imp/CMakeLists.txt
new file mode 100644
index 0000000..7205543
--- /dev/null
+++ b/src/import-export/qif-imp/CMakeLists.txt
@@ -0,0 +1,90 @@
+# CMakeLists.txt for src/import_export/qif-imp
+
+ADD_SUBDIRECTORY(gschemas)
+
+SET (qif_import_SOURCES
+    dialog-account-picker.c
+    assistant-qif-import.c
+    gnc-plugin-qif-import.c
+    gncmod-qif-import.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${qif_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET (qif_import_noinst_HEADERS
+    dialog-account-picker.h
+    assistant-qif-import.h
+    gnc-plugin-qif-import.h
+)
+
+ADD_LIBRARY	(gncmod-qif-import ${qif_import_SOURCES} ${qif_import_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-qif-import gncmod-app-utils gncmod-gnome-utils gnc-gnome)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-qif-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif.import\")
+
+INSTALL(TARGETS gncmod-qif-import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
+
+
+# Scheme
+
+SET (qif_import_SCHEME
+  qif-dialog-utils.scm
+  qif-file.scm
+  qif-guess-map.scm
+  qif-merge-groups.scm
+  qif-objects.scm
+  qif-parse.scm
+  qif-to-gnc.scm
+  qif-utils.scm
+  qif-import.scm # yes, included in both SETs
+)
+
+SET(qif_import_SCHEME_2
+  qif-import.scm
+)
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    src/core-utils src/gnc-module src/scm)
+SET(GUILE_LIBRARY_DIRS src/core-utils src/gnc-module src/gnome)
+SET(GUILE_DEPENDS      gncmod-qif-import scm-core-utils scm-gnc-module scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-qif-import-2
+  "${qif_import_SCHEME_2}"
+  "gnucash/import-export"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-qif-import
+  "${qif_import_SCHEME}"
+  "qif-import"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+SET(qif_import_GLADE assistant-qif-import.glade dialog-account-picker.glade)
+
+INSTALL(FILES ${qif_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+SET(qif_import_UI gnc-plugin-qif-import-ui.xml)
+
+INSTALL(FILES ${qif_import_UI} DESTINATION share/gnucash/ui)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${qif_import_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+  FILE(COPY ${qif_import_GLADE}
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+ENDIF()
\ No newline at end of file
diff --git a/src/import-export/qif-imp/gschemas/CMakeLists.txt b/src/import-export/qif-imp/gschemas/CMakeLists.txt
new file mode 100644
index 0000000..aabed64
--- /dev/null
+++ b/src/import-export/qif-imp/gschemas/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+set(qif_imp_GSCHEMA org.gnucash.dialogs.import.qif.gschema.xml)
+
+ADD_GSCHEMA_TARGETS(qif-imp-gschema "${qif_imp_GSCHEMA}")
diff --git a/src/import-export/qif/CMakeLists.txt b/src/import-export/qif/CMakeLists.txt
new file mode 100644
index 0000000..0bb858a
--- /dev/null
+++ b/src/import-export/qif/CMakeLists.txt
@@ -0,0 +1,33 @@
+
+SET(qif_SOURCES
+  qif-context.c
+  qif-defaults.c
+  qif-file.c
+  qif-objects.c
+  qif-parse.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${qif_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(qif_noinst_HEADERS
+  qif-file.h
+  qif-defaults.h
+  qif-import-p.h
+  qif-import.h
+  qif-objects.h
+  qif-objects-p.h
+  qif-parse.h
+)
+
+ADD_LIBRARY(gncmod-qif ${qif_noinst_HEADERS} ${qif_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-qif gncmod-generic-import gncmod-engine gnc-qof ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-qif PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif\")
+
+INSTALL(TARGETS gncmod-qif
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
diff --git a/src/libqof/CMakeLists.txt b/src/libqof/CMakeLists.txt
index 14964f1..ccc8f46 100644
--- a/src/libqof/CMakeLists.txt
+++ b/src/libqof/CMakeLists.txt
@@ -1,41 +1,80 @@
 # CMakeLists.txt for src/libqof
 
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"qof\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}/.. ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/lib/libc) # for strptime.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src) # for platform.h
+SET (gnc_qof_HEADERS
+    qof/gnc-aqbanking-templates.h
+    qof/gnc-date-p.h
+    qof/gnc-date.h
+    qof/gnc-numeric.h
+    qof/gnc-datetime.hpp
+    qof/gnc-rational.hpp
+    qof/gnc-timezone.hpp
+    qof/guid.h
+    qof/kvp_frame.hpp
+    qof/kvp-value.hpp
+    qof/qof.h
+    qof/qofbackend-p.h
+    qof/qofbackend.h
+    qof/qofbook.h
+    qof/qofbookslots.h
+    qof/qofchoice.h
+    qof/qofclass.h
+    qof/qofevent.h
+    qof/qofid-p.h
+    qof/qofid.h
+    qof/qofinstance-p.h
+    qof/qofinstance.h
+    qof/qoflog.h
+    qof/qofobject.h
+    qof/qofquery.h
+    qof/qofquerycore.h
+    qof/qofsession.h
+    qof/qofutil.h
+    qof/qof-gobject.h
+    qof/qof-string-cache.h
+)
+SET (gnc_qof_noinst_HEADERS
+    qof/qofbook-p.h
+    qof/qofclass-p.h
+    qof/gnc-date-p.h
+    qof/qofevent-p.h
+    qof/gnc-int128.hpp
+    qof/qofobject-p.h
+    qof/qofquery-p.h
+    qof/qofquerycore-p.h
+    qof/qofsession-p.h
+)
 
-SET (libgnc_qof_SOURCES
-   qof/gnc-date.c
-   qof/gnc-numeric.c
-   qof/guid.c
-   qof/kvp-util.c
-   qof/kvp_frame.c
-   qof/md5.c
-   qof/qofbackend.c
-   qof/qofbook.c
-   qof/qofchoice.c
-   qof/qofclass.c
-   qof/qofevent.c
-   qof/qofid.c
-   qof/qofinstance.c
-   qof/qoflog.c
-   qof/qofobject.c
-   qof/qofquery.c
-   qof/qofquerycore.c
-   qof/qofreference.c
-   qof/qofsession.c
-   qof/qofutil.c
-   qof/qof-string-cache.c
+SET (gnc_qof_SOURCES
+   qof/gnc-aqbanking-templates.cpp
+   qof/gnc-date.cpp
+   qof/gnc-datetime.cpp
+   qof/gnc-int128.cpp
+   qof/gnc-numeric.cpp
+   qof/gnc-rational.cpp
+   qof/gnc-datetime.cpp
+   qof/gnc-timezone.cpp
+   qof/guid.cpp
+   qof/kvp_frame.cpp
+   qof/kvp-value.cpp
+   qof/qofbackend.cpp
+   qof/qofbook.cpp
+   qof/qofchoice.cpp
+   qof/qofclass.cpp
+   qof/qofevent.cpp
+   qof/qofid.cpp
+   qof/qofinstance.cpp
+   qof/qoflog.cpp
+   qof/qofobject.cpp
+   qof/qofquery.cpp
+   qof/qofquerycore.cpp
+   qof/qofsession.cpp
+   qof/qofutil.cpp
+   qof/qof-string-cache.cpp
 )
 IF (WIN32)
   ADD_DEFINITIONS (-DOS_WIN32)
-  SET (libgnc_qof_SOURCES ${libgnc_qof_SOURCES}
-    qof/qof-win32.c
+  SET (gnc_qof_SOURCES ${gnc_qof_SOURCES}
+    qof/qof-win32.cpp
 	../../lib/libc/strptime.c
 	../../lib/libc/localtime_r.c
 	../../lib/libc/gmtime_r.c
@@ -43,40 +82,40 @@ IF (WIN32)
 ENDIF (WIN32)
 
 # Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgnc_qof_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (${gnc_qof_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
-SET (libgnc_qof_HEADERS
-   qof/gnc-date-p.h
-   qof/gnc-date.h
-   qof/gnc-numeric.h
-   qof/guid.h
-   qof/kvp-util-p.h
-   qof/kvp-util.h
-   qof/kvp_frame.h
-   qof/qof.h
-   qof/qofbackend-p.h
-   qof/qofbackend.h
-   qof/qofbook.h
-   qof/qofbookslots.h
-   qof/qofchoice.h
-   qof/qofclass.h
-   qof/qofevent.h
-   qof/qofid-p.h
-   qof/qofid.h
-   qof/qofinstance-p.h
-   qof/qofinstance.h
-   qof/qoflog.h
-   qof/qofobject.h
-   qof/qofquery.h
-   qof/qofquerycore.h
-   qof/qofreference.h
-   qof/qofsession.h
-   qof/qofutil.h
-   qof/qof-gobject.h
-   qof/qof-string-cache.h
+ADD_LIBRARY	(gnc-qof
+  ${gnc_qof_SOURCES}
+  ${gnc_qof_HEADERS}
+  ${gnc_qof_noinst_HEADERS}
 )
 
-ADD_LIBRARY	(qof
-  ${libgnc_qof_SOURCES}
-  ${libgnc_qof_HEADERS}
-  )
+TARGET_LINK_LIBRARIES(gnc-qof ${Boost_DATE_TIME_LIBRARIES} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gnc-qof PRIVATE -DG_LOG_DOMAIN=\"qof\")
+
+TARGET_INCLUDE_DIRECTORIES (gnc-qof PUBLIC
+  ${CMAKE_BINARY_DIR}/src # for config.h
+  ${CMAKE_SOURCE_DIR}/src # for platform.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/qof
+  ${GLIB2_INCLUDE_DIRS}
+  ${LIBINTL_INCLUDE_PATH}
+  ${REGEX_INCLUDE_PATH}
+  ${CMAKE_SOURCE_DIR}/lib/libc # for strptime.h
+)
+
+INSTALL(TARGETS gnc-qof
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+INSTALL(FILES ${gnc_qof_HEADERS} DESTINATION include/gnucash)
+
+SET(qof_test_HEADERS
+    qof/kvp_frame.hpp
+    qof/qofbook.h
+    qof/qofinstance.h
+    qof/qofobject.h
+    qof/qofsession.h
+)
+
+INSTALL(FILES ${qof_test_HEADERS} DESTINATION libexec/gnucash/src/libqof/qof/test)
diff --git a/src/pixmaps/CMakeLists.txt b/src/pixmaps/CMakeLists.txt
new file mode 100644
index 0000000..2f0fb27
--- /dev/null
+++ b/src/pixmaps/CMakeLists.txt
@@ -0,0 +1,119 @@
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION share/gnucash
+        PATTERN Makefile.* EXCLUDE
+        PATTERN CMakeLists.txt EXCLUDE
+)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+     DESTINATION ${DATADIR_BUILD}/gnucash/pixmaps
+     PATTERN Makefile.* EXCLUDE
+     PATTERN CMakeLists.txt EXCLUDE
+  )
+ENDIF()
+
+FOREACH(dir 256x256 128x128 96x96 64x64 48x48)
+  INSTALL(
+      FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-icon-${dir}.png
+      RENAME gnucash-icon.png
+      DESTINATION share/icons/hicolor/${dir}/apps)
+  IF(GNC_BUILD_AS_INSTALL)    
+    FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-icon-${dir}.png
+         DESTINATION ${DATADIR_BUILD}/icons/hicolor/${dir}/apps/gnucash-icon-${dir}.png)
+  ENDIF()
+ENDFOREACH(dir)
+
+INSTALL(
+    FILES ${CMAKE_SOURCE_DIR}/art/tango/32x32/gnucash.png
+    RENAME gnucash-icon.png
+    DESTINATION share/icons/hicolor/32x32/apps
+)
+
+INSTALL(
+    FILES ${CMAKE_SOURCE_DIR}/art/tango/22x22/gnucash-22x22.png
+    RENAME gnucash-icon.png
+    DESTINATION share/icons/hicolor/22x22/apps
+)
+INSTALL(
+    FILES ${CMAKE_SOURCE_DIR}/art/tango/22x22/gnucash-24x24.png
+    RENAME gnucash-icon.png
+    DESTINATION share/icons/hicolor/24x24/apps
+)
+INSTALL(
+    FILES ${CMAKE_SOURCE_DIR}/art/tango/16x16/gnucash.png
+    RENAME gnucash-icon.png
+    DESTINATION share/icons/hicolor/16x16/apps
+)
+INSTALL(
+    FILES ${CMAKE_SOURCE_DIR}/art/tango/scalable/gnucash.svg
+    RENAME gnucash-icon.svg
+    DESTINATION share/icons/hicolor/scalable/apps
+)
+INSTALL(
+    FILES ${CMAKE_SOURCE_DIR}/art/tango/16x16/gnucash.png
+    RENAME gnucash-icon-16x16.png
+    DESTINATION share/gnucash/pixmaps
+)
+INSTALL(
+    FILES ${CMAKE_SOURCE_DIR}/art/tango/32x32/gnucash.png
+    RENAME gnucash-icon-32x32.png
+    DESTINATION share/gnucash/pixmaps
+)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(
+    COPY ${CMAKE_SOURCE_DIR}/art/tango/32x32/gnucash.png
+    DESTINATION ${DATADIR_BUILD}/icons/hicolor/32x32/apps
+  )
+  FILE(RENAME ${DATADIR_BUILD}/icons/hicolor/32x32/apps/gnucash.png
+    ${DATADIR_BUILD}/icons/hicolor/32x32/apps/gnucash-icon.png
+    )
+
+  FILE(
+    COPY ${CMAKE_SOURCE_DIR}/art/tango/22x22/gnucash-22x22.png
+    DESTINATION ${DATADIR_BUILD}/icons/hicolor/22x22/apps
+  )
+  FILE(RENAME ${DATADIR_BUILD}/icons/hicolor/22x22/apps/gnucash-22x22.png
+    ${DATADIR_BUILD}/icons/hicolor/22x22/apps/gnucash-icon.png
+    )
+  FILE(
+    COPY ${CMAKE_SOURCE_DIR}/art/tango/22x22/gnucash-24x24.png
+    DESTINATION ${DATADIR_BUILD}/icons/hicolor/24x24/apps
+  )
+  FILE(RENAME ${DATADIR_BUILD}/icons/hicolor/24x24/apps/gnucash-24x24.png
+    ${DATADIR_BUILD}/icons/hicolor/24x24/apps/gnucash-icon.png
+  )
+
+  FILE(
+    COPY ${CMAKE_SOURCE_DIR}/art/tango/16x16/gnucash.png
+    DESTINATION ${DATADIR_BUILD}/icons/hicolor/16x16/apps
+  )
+  FILE(RENAME ${DATADIR_BUILD}/icons/hicolor/16x16/apps/gnucash.png
+    ${DATADIR_BUILD}/icons/hicolor/16x16/apps/gnucash-icon.png
+  )
+
+  FILE(
+    COPY ${CMAKE_SOURCE_DIR}/art/tango/scalable/gnucash.svg
+    DESTINATION ${DATADIR_BUILD}/icons/hicolor/scalable/apps
+  )
+  FILE(RENAME ${DATADIR_BUILD}/icons/hicolor/scalable/apps/gnucash.svg
+    ${DATADIR_BUILD}/icons/hicolor/scalable/apps/gnucash-icon.svg
+  )
+
+  FILE(
+    COPY ${CMAKE_SOURCE_DIR}/art/tango/16x16/gnucash.png
+    DESTINATION ${DATADIR_BUILD}/gnucash/pixmaps
+  )
+  FILE(RENAME ${DATADIR_BUILD}/gnucash/pixmaps/gnucash.png
+              ${DATADIR_BUILD}/gnucash/pixmaps/gnucash-icon-16x16.png
+  )
+
+  FILE(
+    COPY ${CMAKE_SOURCE_DIR}/art/tango/32x32/gnucash.png
+    DESTINATION ${DATADIR_BUILD}/gnucash/pixmaps
+  )
+  FILE(RENAME ${DATADIR_BUILD}/gnucash/pixmaps/gnucash.png
+    ${DATADIR_BUILD}/gnucash/pixmaps/gnucash-icon-32x32.png
+  )
+
+ENDIF()
\ No newline at end of file
diff --git a/src/plugins/bi_import/CMakeLists.txt b/src/plugins/bi_import/CMakeLists.txt
new file mode 100644
index 0000000..dc837ae
--- /dev/null
+++ b/src/plugins/bi_import/CMakeLists.txt
@@ -0,0 +1,43 @@
+
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET(bi_import_SOURCES
+  gnc-plugin-bi-import.c
+  gncmod-bi-import.c
+  dialog-bi-import-gui.c
+  dialog-bi-import-helper.c
+  dialog-bi-import.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${bi_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(bi_import_noinst_HEADERS
+  gnc-plugin-bi-import.h 
+  dialog-bi-import-gui.h 
+  dialog-bi-import-helper.h 
+  dialog-bi-import.h
+)
+
+ADD_LIBRARY(gncmod-bi_import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-bi_import
+  gncmod-business-gnome
+  gncmod-gnome-utils
+  gncmod-gnome-search
+  gncmod-app-utils
+  gncmod-engine
+  gnc-core-utils
+  gnc-module
+  gnc-qof
+)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-bi_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\")
+
+INSTALL(TARGETS gncmod-bi_import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
+
diff --git a/src/plugins/bi_import/gtkbuilder/CMakeLists.txt b/src/plugins/bi_import/gtkbuilder/CMakeLists.txt
new file mode 100644
index 0000000..168e5c2
--- /dev/null
+++ b/src/plugins/bi_import/gtkbuilder/CMakeLists.txt
@@ -0,0 +1,11 @@
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/plugins/bi_import/ui/CMakeLists.txt b/src/plugins/bi_import/ui/CMakeLists.txt
new file mode 100644
index 0000000..6c9019d
--- /dev/null
+++ b/src/plugins/bi_import/ui/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/plugins/customer_import/CMakeLists.txt b/src/plugins/customer_import/CMakeLists.txt
new file mode 100644
index 0000000..75a8c58
--- /dev/null
+++ b/src/plugins/customer_import/CMakeLists.txt
@@ -0,0 +1,32 @@
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET(customer_import_SOURCES
+  gnc-plugin-customer_import.c
+  libgncmod-customer_import.c
+  dialog-customer-import-gui.c
+  dialog-customer-import.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${customer_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+
+SET(customer_import_noinst_HEADERS
+  gnc-plugin-customer_import.h
+  dialog-customer-import-gui.h
+  dialog-customer-import.h
+)
+
+ADD_LIBRARY(gncmod-customer_import ${customer_import_SOURCES} ${customer_input_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-customer_import gncmod-business-gnome gncmod-gnome-utils gncmod-app-utils
+     gncmod-engine gnc-core-utils gnc-module gnc-qof ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-customer_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\")
+
+INSTALL(TARGETS gncmod-customer_import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
\ No newline at end of file
diff --git a/src/plugins/customer_import/gtkbuilder/CMakeLists.txt b/src/plugins/customer_import/gtkbuilder/CMakeLists.txt
new file mode 100644
index 0000000..1d4d3d1
--- /dev/null
+++ b/src/plugins/customer_import/gtkbuilder/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/plugins/customer_import/ui/CMakeLists.txt b/src/plugins/customer_import/ui/CMakeLists.txt
new file mode 100644
index 0000000..6c9019d
--- /dev/null
+++ b/src/plugins/customer_import/ui/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY .
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
+ENDIF()
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    DESTINATION share/gnucash
+    PATTERN Makefile.* EXCLUDE
+    PATTERN CMakeLists.txt EXCLUDE)
diff --git a/src/quotes/CMakeLists.txt b/src/quotes/CMakeLists.txt
new file mode 100644
index 0000000..d00ec9e
--- /dev/null
+++ b/src/quotes/CMakeLists.txt
@@ -0,0 +1,46 @@
+
+
+
+SET(PERL ${PERL_EXECUTABLE})
+
+SET(_TMPDIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+FILE(WRITE ${_TMPDIR}/copy_with_perms.cmake
+  "FILE(COPY \${SRC} DESTINATION \${DST}
+   FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)"
+)
+
+FOREACH(file gnc-fq-check.in gnc-fq-helper.in gnc-fq-update.in gnc-fq-dump)
+  STRING(REPLACE ".in" "" _OUTPUT_FILE_NAME ${file})
+  GNC_CONFIGURE2(${file} ${_OUTPUT_FILE_NAME})
+  SET(_ABS_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_OUTPUT_FILE_NAME})
+  INSTALL(PROGRAMS ${_ABS_OUPUT_FILE} DESTINATION bin)
+  IF (GNC_BUILD_AS_INSTALL)
+    ADD_CUSTOM_COMMAND(
+      OUTPUT ${_ABS_OUTPUT_FILE}
+      APPEND
+      COMMAND ${CMAKE_COMMAND} -D SRC=${_ABS_OUTPUT_FILE}
+                               -D DST=${BINDIR_BUILD}
+                               -P ${_TMPDIR}/copy_with_perms.cmake
+    )
+  ENDIF()
+ENDFOREACH(file)
+
+SET(_MAN_FILES "")
+FOREACH(file gnc-fq-dump gnc-fq-helper)
+  SET(_POD_INPUT ${CMAKE_CURRENT_BINARY_DIR}/${file})
+  SET(_MAN_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file}.1)
+  LIST(APPEND _MAN_FILES ${_MAN_OUTPUT})
+  ADD_CUSTOM_COMMAND(
+      OUTPUT ${_MAN_OUTPUT}
+      COMMAND
+        ${CMAKE_COMMAND} -E env ${PERL_EXECUTABLE} ${POD2MAN_EXECUTABLE} ${_POD_INPUT} ${_MAN_OUTPUT}
+      DEPENDS ${_POD_INPUT}
+  )
+ENDFOREACH(file)
+
+# I don't bother copying the man pages for GNC_BUILD_AS_INSTALL. I probably should for completeness.
+
+ADD_CUSTOM_TARGET(quotes-man ALL DEPENDS ${_MAN_FILES})
+ADD_CUSTOM_TARGET(quotes-bin ALL DEPENDS gnc-fq-check gnc-fq-update)
+INSTALL(FILES ${_MAN_FILES} DESTINATION share/man/man1)
+
diff --git a/src/register/ledger-core/CMakeLists.txt b/src/register/ledger-core/CMakeLists.txt
new file mode 100644
index 0000000..09b3fbc
--- /dev/null
+++ b/src/register/ledger-core/CMakeLists.txt
@@ -0,0 +1,43 @@
+
+
+SET (ledger_core_SOURCES
+  gnc-ledger-display.c
+  gnc-ledger-display2.c
+  gncmod-ledger-core.c
+  split-register.c
+  split-register-control.c
+  split-register-layout.c
+  split-register-load.c
+  split-register-model.c
+  split-register-model-save.c
+  split-register-util.c
+)
+
+SET (ledger_core_HEADERS
+  gnc-ledger-display.h
+  gnc-ledger-display2.h
+  split-register.h
+  split-register-control.h
+  split-register-layout.h
+  split-register-model.h
+  split-register-model-save.h
+  split-register-p.h
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${ledger_core_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY (gncmod-ledger-core ${ledger_core_SOURCES} ${ledger_core_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-ledger-core gncmod-register-gnome gncmod-register-core gncmod-gnome-utils
+        gncmod-engine ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-ledger-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.ledger\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-ledger-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gncmod-ledger-core
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
\ No newline at end of file
diff --git a/src/register/register-core/CMakeLists.txt b/src/register/register-core/CMakeLists.txt
new file mode 100644
index 0000000..c5ab961
--- /dev/null
+++ b/src/register/register-core/CMakeLists.txt
@@ -0,0 +1,59 @@
+
+
+SET (register_core_SOURCES
+  gncmod-register-core.c
+  basiccell.c
+  cell-factory.c
+  cellblock.c
+  formulacell.c
+  gtable.c
+  numcell.c
+  pricecell.c
+  quickfillcell.c
+  recncell.c
+  checkboxcell.c
+  register-common.c
+  table-allgui.c
+  table-control.c
+  table-layout.c
+  table-model.c
+)  
+
+
+SET (register_core_HEADERS
+  basiccell.h
+  cell-factory.h
+  cellblock.h
+  combocell.h
+  datecell.h
+  formulacell.h
+  gtable.h
+  numcell.h
+  pricecell.h
+  quickfillcell.h
+  recncell.h
+  checkboxcell.h
+  register-common.h
+  table-allgui.h
+  table-control.h
+  table-layout.h
+  table-model.h
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${register_core_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY (gncmod-register-core ${register_core_SOURCES} ${register_core_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-register-core gncmod-gnome-utils  gnc-qof gncmod-app-utils ${GMODULE_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-register-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.core\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-register-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gncmod-register-core
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${register_core_HEADERS} DESTINATION include/gnucash)
\ No newline at end of file
diff --git a/src/register/register-gnome/CMakeLists.txt b/src/register/register-gnome/CMakeLists.txt
new file mode 100644
index 0000000..9f0a5db
--- /dev/null
+++ b/src/register/register-gnome/CMakeLists.txt
@@ -0,0 +1,58 @@
+
+SET (register_gnome_SOURCES
+  gncmod-register-gnome.c
+  combocell-gnome.c
+  datecell-gnome.c
+  formulacell-gnome.c
+  gnucash-color.c
+  gnucash-cursor.c
+  gnucash-date-picker.c
+  gnucash-grid.c
+  gnucash-header.c
+  gnucash-item-edit.c
+  gnucash-item-list.c
+  gnucash-scrolled-window.c
+  gnucash-sheet.c
+  gnucash-style.c
+  pricecell-gnome.c
+  quickfillcell-gnome.c
+  table-gnome.c
+)
+
+SET (register_gnome_noinst_HEADERS
+  formulacell-gnome.h
+  gnucash-color.h
+  gnucash-cursor.h
+  gnucash-date-picker.h
+  gnucash-grid.h
+  gnucash-header.h
+  gnucash-item-edit.h
+  gnucash-item-list.h
+  gnucash-scrolled-window.h
+  gnucash-sheet.h
+  gnucash-sheetP.h
+  gnucash-style.h
+  pricecell-gnome.h
+  quickfillcell-gnome.h
+  table-gnome.h
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${register_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY (gncmod-register-gnome ${register_gnome_SOURCES} ${register_gnome_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-register-gnome gncmod-register-core gnc-qof ${GNOMECANVAS_LDFLAGS} ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-register-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.register.gnome\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-register-gnome
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE ${CMAKE_SOURCE_DIR}/src/register/ledger-core ${GNOMECANVAS_INCLUDE_DIRS}
+)
+
+INSTALL(TARGETS gncmod-register-gnome
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
\ No newline at end of file
diff --git a/src/report/CMakeLists.txt b/src/report/CMakeLists.txt
new file mode 100644
index 0000000..cb57c20
--- /dev/null
+++ b/src/report/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+ADD_SUBDIRECTORY(business-reports)
+ADD_SUBDIRECTORY(jqplot)
+ADD_SUBDIRECTORY(locale-specific/us)
+ADD_SUBDIRECTORY(report-gnome)
+ADD_SUBDIRECTORY(report-system)
+ADD_SUBDIRECTORY(standard-reports)
+ADD_SUBDIRECTORY(stylesheets)
+ADD_SUBDIRECTORY(utility-reports)
+
diff --git a/src/report/business-reports/CMakeLists.txt b/src/report/business-reports/CMakeLists.txt
new file mode 100644
index 0000000..70687af
--- /dev/null
+++ b/src/report/business-reports/CMakeLists.txt
@@ -0,0 +1,46 @@
+
+SET (business_reports_SCHEME
+  aging.scm
+  customer-summary.scm
+  easy-invoice.scm
+  fancy-invoice.scm
+  taxinvoice.scm
+  receipt.scm
+  invoice.scm
+  job-report.scm
+  owner-report.scm
+  payables.scm
+  receivables.scm
+  balsheet-eg.scm
+  business-reports.scm
+)
+
+SET(business_reports_DATA
+  taxinvoice.eguile.scm
+  taxinvoice.css
+  receipt.eguile.scm
+  receipt.css
+  balsheet-eg.css
+  balsheet-eg.eguile.scm
+)
+
+SET(GUILE_OUTPUT_DIR   gnucash/report)
+SET(GUILE_MODULES      src/app-utils src/engine src/html src/gnome-utils
+                         src/report/report-system src/report/standard-reports)
+SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/scm
+                         src/report/business_reports src/report/report-system src/report/standard-reports)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system
+                         src/report/standard-reports)
+SET(GUILE_DEPENDS      scm-business-reports-links gncmod-standard-reports scm-standard-reports)
+
+GNC_ADD_SCHEME_TARGETS(scm-business-reports
+  "${business_reports_SCHEME}"
+  ${GUILE_OUTPUT_DIR} 
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  TRUE
+)
+
+INSTALL(FILES ${business_reports_DATA} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/gnucash/report)
\ No newline at end of file
diff --git a/src/report/jqplot/CMakeLists.txt b/src/report/jqplot/CMakeLists.txt
new file mode 100644
index 0000000..b168ce1
--- /dev/null
+++ b/src/report/jqplot/CMakeLists.txt
@@ -0,0 +1,33 @@
+
+SET(gncjqplot_DATA
+  jquery.min.js
+  jquery.jqplot.js
+  jquery.jqplot.css
+  plugins/jqplot.barRenderer.js
+  plugins/jqplot.BezierCurveRenderer.js
+  plugins/jqplot.blockRenderer.js
+  plugins/jqplot.bubbleRenderer.js
+  plugins/jqplot.canvasAxisLabelRenderer.js
+  plugins/jqplot.canvasAxisTickRenderer.js
+  plugins/jqplot.canvasTextRenderer.js
+  plugins/jqplot.categoryAxisRenderer.js
+  plugins/jqplot.ciParser.js
+  plugins/jqplot.cursor.js
+  plugins/jqplot.dateAxisRenderer.js
+  plugins/jqplot.donutRenderer.js
+  plugins/jqplot.dragable.js
+  plugins/jqplot.enhancedLegendRenderer.js
+  plugins/jqplot.funnelRenderer.js
+  plugins/jqplot.highlighter.js
+  plugins/jqplot.json2.js
+  plugins/jqplot.logAxisRenderer.js
+  plugins/jqplot.mekkoAxisRenderer.js
+  plugins/jqplot.mekkoRenderer.js
+  plugins/jqplot.meterGaugeRenderer.js
+  plugins/jqplot.ohlcRenderer.js
+  plugins/jqplot.pieRenderer.js
+  plugins/jqplot.pointLabels.js
+  plugins/jqplot.trendline.js
+)
+
+INSTALL(FILES ${gncjqplot_DATA} DESTINATION share/gnucash/jqplot)
\ No newline at end of file
diff --git a/src/report/locale-specific/us/CMakeLists.txt b/src/report/locale-specific/us/CMakeLists.txt
new file mode 100644
index 0000000..1945079
--- /dev/null
+++ b/src/report/locale-specific/us/CMakeLists.txt
@@ -0,0 +1,54 @@
+
+
+SET(locale_reports_us_SOURCES
+  gncmod-locale-reports-us.c
+)
+
+ADD_LIBRARY(gncmod-locale-reports-us ${locale_reports_us_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-locale-reports-us gnc-module gncmod-app-utils gncmod-gnome-utils
+                         ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-locale-reports-us PRIVATE -DG_LOG_DOMAIN=\"gnc.report.locale.us\")
+
+
+INSTALL(TARGETS gncmod-locale-reports-us
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# Scheme
+
+SET(gncmod_local_reports_us_SCHEME_1 taxtxf.scm taxtxf-de_DE.scm)
+
+
+SET(gncmod_local_reports_us_SCHEME_2 us.scm de_DE.scm)
+
+
+SET(GUILE_MODULES src/app-utils src/engine src/gnome-utils src/html src/report/report-system src/tax/us)
+SET(GUILE_LOAD_DIRS  src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system
+                     src/scm src/tax/us)
+SET(GUILE_LIBRARY_DIRS src/engine src/libqof/qof src/app-utils src/core-utils src/gnc-module src/gnome-utils
+                       src/html src/report/report-system)
+SET(GUILE_DEPENDS   gncmod-html scm-tax-us-1 scm-tax-us-2 scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-locale-specific-1
+  "${gncmod_local_reports_us_SCHEME_1}"
+  gnucash/report
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-locale-specific-2
+  "${gncmod_local_reports_us_SCHEME_2}"
+  gnucash/report/locale-specific
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-report-locale-specific-1;${GUILE_DEPENDS}"
+  FALSE
+)
\ No newline at end of file
diff --git a/src/report/report-gnome/CMakeLists.txt b/src/report/report-gnome/CMakeLists.txt
new file mode 100644
index 0000000..8df635e
--- /dev/null
+++ b/src/report/report-gnome/CMakeLists.txt
@@ -0,0 +1,77 @@
+
+
+SET (report_gnome_HEADERS
+  dialog-report-column-view.h
+  dialog-custom-report.h
+  dialog-report-style-sheet.h
+  gnc-plugin-page-report.h
+  window-report.h
+)
+
+SET (SWIG_REPORT_GNOME_C ${CMAKE_CURRENT_BINARY_DIR}/swig-report-gnome.c)
+GNC_ADD_SWIG_COMMAND (${SWIG_REPORT_GNOME_C} ${CMAKE_CURRENT_SOURCE_DIR}/report-gnome.i ${report_gnome_HEADERS})
+
+SET (report_gnome_SOURCES
+  ${SWIG_REPORT_GNOME_C}
+  dialog-report-column-view.c
+  dialog-custom-report.c
+  dialog-report-style-sheet.c
+  gnc-plugin-page-report.c
+  gncmod-report-gnome.c
+  window-report.c
+)
+
+ADD_LIBRARY (gncmod-report-gnome
+  ${report_gnome_SOURCES}
+  ${report_gnome_HEADERS}
+)
+TARGET_LINK_LIBRARIES(gncmod-report-gnome gncmod-report-system gncmod-html gncmod-gnome-utils
+      gnc-qof ${GUILE_LDFLAGS} ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-report-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.report.gui\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-report-gnome PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gncmod-report-gnome
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${report_gnome_HEADERS} DESTINATION include/gnucash)
+
+# Scheme
+
+SET(report_gnome_SCHEME
+    report-gnome.scm
+)
+
+SET(GUILE_OUTPUT_DIR   gnucash/report)
+SET(GUILE_MODULES      src/app-utils src/scm src/engine src/gnc-module src/gnome-utils src/reports/report-system src/report/utility-reports)
+SET(GUILE_LOAD_DIRS    src/app-utils src/gnc-module src/engine src/scm src/core-utils src/gnome-utils)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report-gnome)
+SET(GUILE_DEPENDS      gncmod-report-gnome gncmod-engine scm-app-utils scm-gnome-utils scm-core-utils scm-gnc-module scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-gnome
+    "${report_gnome_SCHEME}"
+    ${GUILE_OUTPUT_DIR}
+    "${GUILE_MODULES}"
+    "${GUILE_LOAD_DIRS}"
+    "${GUILE_LIBRARY_DIRS}"
+    "${GUILE_DEPENDS}"
+    FALSE
+)
+
+SET(report_gnome_GLADE dialog-custom-report.glade dialog-report.glade)
+
+INSTALL(FILES ${report_gnome_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+SET(report_gnome_UI gnc-plugin-page-report-ui.xml)
+
+INSTALL(FILES ${report_gnome_UI} DESTINATION share/gnucash/ui)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${report_gnome_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+  FILE(COPY ${report_gnome_GLADE}
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+ENDIF()
\ No newline at end of file
diff --git a/src/report/report-system/CMakeLists.txt b/src/report/report-system/CMakeLists.txt
new file mode 100644
index 0000000..33db0fd
--- /dev/null
+++ b/src/report/report-system/CMakeLists.txt
@@ -0,0 +1,107 @@
+
+SET (report_system_HEADERS
+  gnc-report.h
+)  
+
+SET (SWIG_REPORT_SYSTEM_C ${CMAKE_CURRENT_BINARY_DIR}/swig-report-system.c)
+GNC_ADD_SWIG_COMMAND (${SWIG_REPORT_SYSTEM_C} ${CMAKE_CURRENT_SOURCE_DIR}/report-system.i ${report_system_HEADERS})
+
+SET (report_system_SOURCES
+  ${SWIG_REPORT_SYSTEM_C}
+  gncmod-report-system.c
+  gnc-report.c
+)  
+
+ADD_LIBRARY (gncmod-report-system
+  ${report_system_SOURCES}
+  ${report_system_HEADERS}
+)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-report-system PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
+
+TARGET_LINK_LIBRARIES(gncmod-report-system gnc-module gncmod-app-utils gnc-qof ${GTK2_LDFLAGS} ${GUILE_LDFLAGS})
+
+TARGET_INCLUDE_DIRECTORIES (gncmod-report-system
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${GTK2_INCLUDE_DIRS}
+)
+
+
+INSTALL(TARGETS gncmod-report-system
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${report_system_HEADERS} DESTINATION include/gnucash)
+
+# Scheme
+
+SET (report_system_SCHEME
+    report-system.scm
+    eguile-gnc.scm
+    eguile-utilities.scm
+    eguile-html-utilities.scm
+)
+
+SET (report_system_SCHEME_2
+    collectors.scm
+    list-extras.scm
+    report-collectors.scm
+)
+
+SET (report_system_SCHEME_3
+    commodity-utilities.scm
+    html-acct-table.scm
+    html-barchart.scm
+    html-document.scm
+    html-fonts.scm
+    html-piechart.scm
+    html-scatter.scm
+    html-linechart.scm
+    html-style-info.scm
+    html-style-sheet.scm
+    html-table.scm
+    html-text.scm
+    html-utilities.scm
+    html-jqplot.scm
+    options-utilities.scm
+    report-utilities.scm
+    report.scm
+)
+
+
+SET(GUILE_MODULES      src/app-utils src/engine src/html src/gnome-utils)
+SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system src/scm)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils)
+SET(GUILE_DEPENDS      gncmod-html gncmod-gnome-utils gncmod-report-system scm-app-utils scm-gnome-utils)
+
+
+GNC_ADD_SCHEME_TARGETS(scm-report-system
+  "${report_system_SCHEME}"
+  "gnucash/report"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-system-2
+  "${report_system_SCHEME_2}"
+  "gnucash/report/report-system"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-report-system
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-system-3
+  "${report_system_SCHEME_3}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-report-system-2
+  FALSE
+)
+
diff --git a/src/report/standard-reports/CMakeLists.txt b/src/report/standard-reports/CMakeLists.txt
new file mode 100644
index 0000000..53bb1cd
--- /dev/null
+++ b/src/report/standard-reports/CMakeLists.txt
@@ -0,0 +1,84 @@
+
+SET(standard_reports_SOURCES gncmod-standard-reports.c)
+
+ADD_LIBRARY (gncmod-standard-reports ${standard_reports_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-standard-reports gnc-module ${GTK2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-standard-reports PRIVATE -DG_LOG_DOMAIN=\"gnc.report.standard\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-standard-reports PRIVATE ${GUILE_INCLUDE_DIRS})
+
+INSTALL(TARGETS gncmod-standard-reports
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+# No headers to install
+
+
+# Scheme
+
+SET (standard_reports_SCHEME standard-reports.scm)
+
+SET (standard_reports_SCHEME_2
+    account-piecharts.scm
+    account-summary.scm
+    advanced-portfolio.scm
+    average-balance.scm
+    balance-sheet.scm
+    budget-balance-sheet.scm
+    budget-barchart.scm
+    budget-flow.scm
+    budget-income-statement.scm
+    budget.scm
+    cash-flow.scm
+    category-barchart.scm
+    daily-reports.scm
+    equity-statement.scm
+    general-journal.scm
+    general-ledger.scm
+    income-statement.scm
+    net-barchart.scm
+    net-linechart.scm
+    portfolio.scm
+    price-scatter.scm
+    register.scm
+    sx-summary.scm
+    transaction.scm
+    trial-balance.scm
+    )
+
+SET(GUILE_MODULES      src/app-utils src/engine src/gnome-utils src/html src/report/report-system)
+SET(GUILE_LOAD_DIRS    src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/report-system src/scm)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/report-system)
+SET(GUILE_DEPENDS      gncmod-html scm-app-utils scm-gnome-utils scm-report-system scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-standard-reports
+  "${standard_reports_SCHEME}"
+  "gnucash/report"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-standard-reports-2;${GUILE_DEPENDS}"
+  TRUE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-standard-reports-2
+  "${standard_reports_SCHEME_2}"
+  "gnucash/report/standard-reports"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-standard-reports-2-links;${GUILE_DEPENDS}"
+  TRUE
+)
+
+# FIXME: This is a hack since core-utils assumes an autotools build environment.
+
+SET(STD_RPT_DIR ${CMAKE_CURRENT_BINARY_DIR}/gnucash/report)
+FILE(MAKE_DIRECTORY ${STD_RPT_DIR})
+FILE(COPY standard-reports.scm DESTINATION ${STD_RPT_DIR})
+
+FILE(MAKE_DIRECTORY ${STD_RPT_DIR}/standard-reports)
+FILE(COPY ${standard_reports_SCHEME_2} DESTINATION ${STD_RPT_DIR}/standard-reports)
\ No newline at end of file
diff --git a/src/report/stylesheets/CMakeLists.txt b/src/report/stylesheets/CMakeLists.txt
new file mode 100644
index 0000000..8649c37
--- /dev/null
+++ b/src/report/stylesheets/CMakeLists.txt
@@ -0,0 +1,80 @@
+
+SET(stylesheets_SOURCES
+  gnc-plugin-stylesheets.c
+  gncmod-stylesheets.c
+)
+
+SET(stylesheet_noinst_HEADERS
+  gnc-plugin-stylesheets.h
+)
+
+ADD_LIBRARY(gncmod-stylesheets MODULE ${stylesheets_SOURCES} ${stylesheets_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-stylesheets gncmod-report-gnome gncmod-report-system gncmod-gnome-utils gnc-module
+    gnc-qof ${GUILE_LDFLAGS} ${GTK2_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-stylesheets PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
+
+SET(LIB_DIR lib/gnucash)
+IF (WIN32)
+  SET(LIB_DIR bin)
+ENDIF(WIN32)
+
+
+INSTALL(TARGETS gncmod-stylesheets
+  LIBRARY DESTINATION ${LIB_DIR}
+  ARCHIVE DESTINATION ${LIB_DIR}
+  RUNTIME DESTINATION bin)
+
+# No headers to install
+
+# Scheme
+
+SET(stylesheets_SCHEME_1
+  stylesheet-plain.scm
+  stylesheet-fancy.scm
+  stylesheet-footer.scm
+  stylesheet-easy.scm
+  stylesheet-head-or-tail.scm
+)
+
+SET(stylesheets_SCHEME_2
+  stylesheets.scm
+)
+
+SET(GUILE_OUTPUT_DIR gnucash/report)
+SET(GUILE_MODULES src/app-utils src/engine src/html src/gnome-utils src/report/report-system)
+SET(GUILE_LOAD_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system src/scm)
+SET(GUILE_LIBRARY_DIRS src/engine src/app-utils src/core-utils src/gnc-module src/gnome-utils src/html src/report/report-system)
+SET(GUILE_DEPENDS gncmod-html scm-app-utils scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-stylesheets-1
+  "${stylesheets_SCHEME_1}"
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  TRUE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-stylesheets-2
+  "${stylesheets_SCHEME_2}"
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-report-stylesheets-1;${GUILE_DEPENDS}"
+  TRUE
+)
+
+ADD_CUSTOM_TARGET(scm-report-stylesheets ALL DEPENDS scm-report-stylesheets-1 scm-report-stylesheets-2)
+
+SET(stylesheets_UI gnc-plugin-stylesheets-ui.xml)
+
+INSTALL(FILES ${stylesheets_UI} DESTINATION share/gnucash/ui)
+
+IF (GNC_BUILD_AS_INSTALL)
+  FILE(COPY ${stylesheets_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+ENDIF()
\ No newline at end of file
diff --git a/src/report/utility-reports/CMakeLists.txt b/src/report/utility-reports/CMakeLists.txt
new file mode 100644
index 0000000..c0110c4
--- /dev/null
+++ b/src/report/utility-reports/CMakeLists.txt
@@ -0,0 +1,55 @@
+
+
+SET(utility_reports_SOURCES
+  gncmod-utility-reports.c
+)
+
+ADD_LIBRARY(gncmod-utility-reports MODULE ${utility_reports_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-utility-reports gnc-module ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-utility-reports PRIVATE -DG_LOG_DOMAIN=\"gnc.report.util\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-utility-reports
+    PRIVATE ${GUILE_INCLUDE_DIRS}
+)
+
+SET(LIB_DIR lib/gnucash)
+IF (WIN32)
+  SET(LIB_DIR bin)
+ENDIF(WIN32)
+
+
+INSTALL(TARGETS gncmod-utility-reports
+  LIBRARY DESTINATION ${LIB_DIR}
+  ARCHIVE DESTINATION ${LIB_DIR}
+  RUNTIME DESTINATION bin)
+
+# Scheme
+
+SET(utility_reports_SCHEME
+  hello-world.scm
+  utility-reports.scm
+  view-column.scm
+  welcome-to-gnucash.scm
+)
+
+SET(GUILE_OUTPUT_DIR     gnucash/report)
+SET(GUILE_MODULES        src/app-utils src/engine src/gnome-utils src/html src/report/report-system)
+SET(GUILE_LOAD_DIRS      src/app-utils src/core-utils src/engine src/gnc-module
+                            src/gnome-utils src/report/report-system src/scm)
+SET(GUILE_LIBRARY_DIRS   src/engine src/app-utils src/core-utils src/gnc-module src/gnome-utils src/html
+                              src/report/report-system)
+SET(GUILE_DEPENDS        scm-utility-reports-links scm-app-utils scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-utility-reports
+  "${utility_reports_SCHEME}"
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  TRUE
+)
+
+
diff --git a/src/scm/CMakeLists.txt b/src/scm/CMakeLists.txt
new file mode 100644
index 0000000..5cd7fe0
--- /dev/null
+++ b/src/scm/CMakeLists.txt
@@ -0,0 +1,66 @@
+ADD_SUBDIRECTORY(gnumeric)
+
+SET (BUILD_CONFIG_SCM ${CMAKE_CURRENT_BINARY_DIR}/build-config.scm)
+
+SET (scm_SCHEME_4
+    substring-search.scm
+    xml-generator.scm
+)
+
+# We need to replace a couple of variables in build-config.scm. Normally, I 
+# would use CONFIGURE_FILE to do this. But this scheme files is using a different
+# replacement marking scheme ("@-", "-@") than the usual one with just "@" 
+# that CONFIGURE_FILE expects.
+
+# FIXME: ${BUILD_CONFIG_SCM} needs a rule to cause it to be generated, I think.
+
+IF (HAVE_GUILE1)
+  GNC_CONFIGURE(build-config.scm.in build-config.scm)
+ELSE()
+  GNC_CONFIGURE2(build-config.scm.in build-config.scm)
+ENDIF()
+
+# CONFIGURE_FILE(build-config.scm.in ${BUILD_CONFIG_SCM})
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    src/core-utils src/gnc-module)
+SET(GUILE_LIBRARY_DIRS src/core-utils src/gnc-module)
+SET(GUILE_DEPENDS      scm-core-utils scm-gnc-module)
+
+SET(scm_SCHEME_0
+  fin.scm
+  string.scm
+  ${BUILD_CONFIG_SCM}
+  substring-search.scm
+  xml-generator.scm
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-scm-0 "${scm_SCHEME_0}" "" "" "" "" "" FALSE)
+
+GNC_ADD_SCHEME_TARGETS(scm-scm-1 "printf.scm" gnucash "" "" "" "" FALSE)
+
+GNC_ADD_SCHEME_TARGETS(scm-scm-2
+  main.scm
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-scm-1;${GUILE_DEPENDS}"  # requires printf.scm from scm-scm-1 and modules from GUILE_DEPENDS
+  FALSE
+)
+
+# depends on main.scm
+GNC_ADD_SCHEME_TARGETS(scm-scm-3
+  price-quotes.scm
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-scm-2;scm-scm-0"  # depends on build_config.scm
+  FALSE)
+
+ADD_CUSTOM_TARGET(scm-scm ALL DEPENDS scm-scm-3 scm-scm-2 scm-scm-1 scm-scm-0 scm-gnumeric)
+
+INSTALL(FILES config DESTINATION etc/gnucash)
+
+
diff --git a/src/scm/gnumeric/CMakeLists.txt b/src/scm/gnumeric/CMakeLists.txt
new file mode 100644
index 0000000..7c38667
--- /dev/null
+++ b/src/scm/gnumeric/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+
+SET(gnumeric_SCHEME gnumeric-utilities.scm table-utils.scm)
+
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    "")
+SET(GUILE_LIBRARY_DIRS "")
+SET(GUILE_DEPENDS      "")
+
+GNC_ADD_SCHEME_TARGETS(scm-gnumeric
+  "${gnumeric_SCHEME}"
+  gnumeric
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
diff --git a/src/tax/us/CMakeLists.txt b/src/tax/us/CMakeLists.txt
new file mode 100644
index 0000000..0424b78
--- /dev/null
+++ b/src/tax/us/CMakeLists.txt
@@ -0,0 +1,48 @@
+SET(tax_us_SOURCES gncmod-tax-us.c)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${tax_us_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY(gncmod-tax-us ${tax_us_SOURCES})
+TARGET_LINK_LIBRARIES(gncmod-tax-us gnc-module ${GLIB2_LDFLAGS} ${GUILE_LDFLAGS})
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-tax-us
+    PRIVATE ${CMAKE_BINARY_DIR}/src ${GUILE_INCLUDE_DIRS})
+
+INSTALL(TARGETS gncmod-tax-us
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# Scheme
+
+SET(gncmod_tax_us_SCHEME_1 txf.scm txf-help.scm txf-de_DE.scm txf-help-de_DE.scm)
+SET(gncmod_tax_us_SCHEME_2 de_DE.scm us.scm)
+
+SET(GUILE_MODULES      src/app-utils src/engine)
+SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/scm)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/engine src/gnc-module)
+SET(GUILE_DEPENDS      scm-app-utils)
+
+GNC_ADD_SCHEME_TARGETS(scm-tax-us-1
+  "${gncmod_tax_us_SCHEME_1}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+  )
+GNC_ADD_SCHEME_TARGETS(scm-tax-us-2
+  "${gncmod_tax_us_SCHEME_2}"
+  gnucash/tax
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+  )
+
+
+
diff --git a/src/test-core/CMakeLists.txt b/src/test-core/CMakeLists.txt
new file mode 100644
index 0000000..63177b6
--- /dev/null
+++ b/src/test-core/CMakeLists.txt
@@ -0,0 +1,54 @@
+
+SET(test_core_SOURCES
+  test-stuff.c
+  unittest-support.c
+)
+
+SET(test_core_noinst_HEADERS
+  test-stuff.h
+  unittest-support.h
+)
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_BINARY_DIR}/src
+  ${CMAKE_SOURCE_DIR}/src
+  ${CMAKE_SOURCE_DIR}/src/libqof/qof
+  ${CMAKE_SOURCE_DIR}/src/test-core
+
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+ADD_LIBRARY(test-core ${test_core_SOURCES} ${test_core_noinst_HEADERS})
+TARGET_LINK_LIBRARIES(test-core gnc-qof ${GLIB2_LDFLAGS})
+
+SET (SWIG_UNITTEST_SUPPORT_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-unittest-support-guile.c)
+GNC_ADD_SWIG_COMMAND (${SWIG_UNITTEST_SUPPORT_GUILE_C}
+    ${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i ${test_core_HEADERS})
+
+
+SET(test_core_guile_SOURCES ${SWIG_UNITTEST_SUPPORT_GUILE_C})
+
+ADD_LIBRARY(test-core-guile ${test_core_guile_SOURCES})
+TARGET_LINK_LIBRARIES(test-core-guile test-core ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+SET(test_core_SCHEME unittest-support.scm)
+
+SET(GUILE_OUTPUT_DIR   gnucash)
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    "")
+SET(GUILE_LIBRARY_DIRS src/test-core src/libqof)
+SET(GUILE_DEPENDS      test-core-guile)
+
+
+GNC_ADD_SCHEME_TARGETS(scm_test_core
+  ${test_core_SCHEME}
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+INSTALL(FILES unittest-support.h DESTINATION libexec/gnucash/src/libqof/qof/test)
\ No newline at end of file

commit e5a4a5c4320f0f552e3bc3c894c15f8a066ca998
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jan 12 11:56:51 2016 -0800

    Bug 760529 - Get Quotes updates value just once per day

diff --git a/src/scm/price-quotes.scm b/src/scm/price-quotes.scm
index f3d97e0..2a5e1f7 100644
--- a/src/scm/price-quotes.scm
+++ b/src/scm/price-quotes.scm
@@ -1,17 +1,17 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; price-quotes.scm - manage sub-processes.
 ;;; Copyright 2001 Rob Browning <rlb at cs.utexas.edu>
-;;; 
-;;; This program is free software; you can redistribute it and/or    
-;;; modify it under the terms of the GNU General Public License as   
-;;; published by the Free Software Foundation; either version 2 of   
-;;; the License, or (at your option) any later version.              
-;;;                                                                  
-;;; This program is distributed in the hope that it will be useful,  
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of   
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
-;;; GNU General Public License for more details.                     
-;;;                                                                  
+;;;
+;;; This program is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU General Public License as
+;;; published by the Free Software Foundation; either version 2 of
+;;; the License, or (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with this program; if not, contact:
 ;;;
@@ -35,7 +35,7 @@
 
 (define (item-list->hash! lst hash
 			  getkey getval
-			  hashref hashset 
+			  hashref hashset
 			  list-duplicates?)
   ;; Takes a list of the form (item item item item) and returns a hash
   ;; formed by traversing the list, and getting the key and val from
@@ -58,7 +58,7 @@
 	  (if existing-val
 	      (hashset hash key (cons val existing-val))
 	      (hashset hash key (list val))))))
-  
+
   (for-each handle-item lst)
   hash)
 
@@ -205,7 +205,7 @@
     ;; a list of the corresponding commodities.  Also perform a bit of
     ;; optimization, merging calls for symbols to the same
     ;; Finance::Quote method.
-    ;; 
+    ;;
     ;; Returns a list of the info needed for a set of calls to
     ;; gnc-fq-helper.  Each item will of the list will be of the
     ;; form:
@@ -223,7 +223,7 @@
 	   (commodity-list #f)
 	   (currency-list (filter
 			   (lambda (a) (not (gnc-commodity-equiv (cadr a) (caddr a))))
-			   (call-with-values 
+			   (call-with-values
                                (lambda () (partition!
                                            (lambda (cmd)
                                              (not (string=? (car cmd) "currency")))
@@ -257,7 +257,7 @@
     ;;
     ;; ("yahoo" (commodity-1 currency-1 tz-1)
     ;;          (commodity-2 currency-2 tz-2) ...)
-    ;; 
+    ;;
     ;; ("yahoo" "IBM" "AMD" ...)
     ;;
 
@@ -412,7 +412,7 @@
                                                       commodity currency
                                                       gnc-time))
             (if (not (null? saved-price))
-                (if (> (gnc-price-get-source saved-price) PRICE-SOURCE-FQ)
+                (if (>= (gnc-price-get-source saved-price) PRICE-SOURCE-FQ)
                     (begin
                       (gnc-price-begin-edit saved-price)
                       (gnc-price-set-time saved-price gnc-time)

commit 4d9440f38b0e143d83717625ed3a124478dd3a98
Author: Mike Evans <mikee at saxicola.co.uk>
Date:   Tue Jan 12 14:48:41 2016 +0000

    Added some comments.

diff --git a/src/plugins/bi_import/dialog-bi-import-gui.c b/src/plugins/bi_import/dialog-bi-import-gui.c
index 882a26a..fa14669 100644
--- a/src/plugins/bi_import/dialog-bi-import-gui.c
+++ b/src/plugins/bi_import/dialog-bi-import-gui.c
@@ -289,6 +289,7 @@ void gnc_bi_import_gui_filenameChanged_cb (GtkWidget *widget, gpointer data)
     g_free( filename );
 }
 
+// Semicolon separated
 void gnc_bi_import_gui_option1_cb (GtkWidget *widget, gpointer data)
 {
     BillImportGui *gui = data;
@@ -298,6 +299,7 @@ void gnc_bi_import_gui_option1_cb (GtkWidget *widget, gpointer data)
     gnc_bi_import_gui_filenameChanged_cb (gui->entryFilename, gui);
 }
 
+// Comma separated
 void gnc_bi_import_gui_option2_cb (GtkWidget *widget, gpointer data)
 {
     BillImportGui *gui = data;
@@ -307,6 +309,7 @@ void gnc_bi_import_gui_option2_cb (GtkWidget *widget, gpointer data)
     gnc_bi_import_gui_filenameChanged_cb (gui->entryFilename, gui);
 }
 
+// Semicolon separated with quotes
 void gnc_bi_import_gui_option3_cb (GtkWidget *widget, gpointer data)
 {
     BillImportGui *gui = data;
@@ -316,6 +319,7 @@ void gnc_bi_import_gui_option3_cb (GtkWidget *widget, gpointer data)
     gnc_bi_import_gui_filenameChanged_cb (gui->entryFilename, gui);
 }
 
+// Comma separated with quote
 void gnc_bi_import_gui_option4_cb (GtkWidget *widget, gpointer data)
 {
     BillImportGui *gui = data;
@@ -325,6 +329,7 @@ void gnc_bi_import_gui_option4_cb (GtkWidget *widget, gpointer data)
     gnc_bi_import_gui_filenameChanged_cb (gui->entryFilename, gui);
 }
 
+// DIY regex.
 void gnc_bi_import_gui_option5_cb (GtkWidget *widget, gpointer data)
 {
     BillImportGui *gui = data;



Summary of changes:
 CMakeLists.txt                               | 20 +++++++++-----------
 cmake/CMakeLists.txt                         |  3 ++-
 po/CMakeLists.txt                            |  4 ++--
 src/engine/CMakeLists.txt                    |  2 +-
 src/import-export/CMakeLists.txt             |  2 +-
 src/import-export/aqb/CMakeLists.txt         |  2 +-
 src/libqof/CMakeLists.txt                    |  3 ++-
 src/plugins/bi_import/dialog-bi-import-gui.c |  5 +++++
 src/quotes/CMakeLists.txt                    |  4 +++-
 src/report/business-reports/CMakeLists.txt   |  2 +-
 src/report/stylesheets/CMakeLists.txt        |  2 +-
 src/scm/price-quotes.scm                     |  2 +-
 12 files changed, 29 insertions(+), 22 deletions(-)



More information about the gnucash-changes mailing list