Implement 'dist', 'distcheck' and 'uninstall' targets for CMake

This commit is contained in:
Rob Gowin
2017-02-01 21:48:46 -06:00
committed by John Ralls
parent 7ba5a84609
commit 6b14dc5b59
183 changed files with 2962 additions and 766 deletions

View File

@@ -10,22 +10,25 @@ IF (APPLE)
ENDIF(APPLE)
IF (GNC_BUILD_AS_INSTALL)
SET(CMAKE_COMMAND_TMP "")
IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
ENDIF()
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(CMAKE_COMMAND_TMP "")
IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
ENDIF()
SET(SCHEMA_DIRECTORY ${DATADIR_BUILD}/glib-2.0/schemas)
ADD_CUSTOM_COMMAND(
OUTPUT ${SCHEMA_DIRECTORY}/gschemas.compiled
COMMAND ${CMAKE_COMMAND_TMP} ${GLIB_COMPILE_SCHEMAS} ${SCHEMA_DIRECTORY}
DEPENDS ${schema-targets}
)
SET(schema-targets business-gnome-gschema csv-exp-gschema csv-imp-gschema
generic-import-gschema gnome-gschema gnome-utils-gschema ofx-gschema qif-imp-gschema)
ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_DIRECTORY}/gschemas.compiled)
IF (WITH_AQBANKING)
LIST(APPEND schema_targets aqb-gschema)
ENDIF (WITH_AQBANKING)
SET(SCHEMA_DIRECTORY ${DATADIR_BUILD}/glib-2.0/schemas)
ADD_CUSTOM_COMMAND(
OUTPUT ${SCHEMA_DIRECTORY}/gschemas.compiled
COMMAND ${CMAKE_COMMAND_TMP} ${GLIB_COMPILE_SCHEMAS} ${SCHEMA_DIRECTORY}
DEPENDS ${schema-targets}
)
ENDIF(GNC_BUILD_AS_INSTALL)
ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_DIRECTORY}/gschemas.compiled)
SET_DIST_LIST(cmake_DIST CMakeLists.txt README_CMAKE.txt cmake_uninstall.cmake.in)

View File

@@ -29,10 +29,17 @@ faster that using the default Makefile generator to me.)
== Scope
The scope of the current work is to duplicate the `make`,
`make check` and `make install` actions as the Autotools system would.
Currently, there is no support for `make dist`, `make distcheck` or
similar targets. Other limitations include:
The scope of the current work is to duplicate these actions as
the Autotools system would:
* make
* make check
* make install
* make uninstall
* make dist
* make distcheck
Limitations include:
* Not all options available in `./configure` have been ported to
this CMake system.
@@ -44,21 +51,11 @@ similar targets. Other limitations include:
* 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
@@ -71,7 +68,7 @@ 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.
3.0 of CMake.
=== Running CMake
@@ -180,10 +177,21 @@ directly from the build directory:
In you chose to install, you can switch to the install directory and
do the same.
=== Building a Distribution Tarball
To create a distribution, use the 'dist' and 'distcheck' targets.
For ninja, use:
$ ninja dist
$ ninja distcheck
For Makefiles:
$ make dist
$ make distcheck
== 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.

View File

@@ -0,0 +1,23 @@
# This is taken from https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)