From eceeca65839d5e61234c235d5a6df0e360707862 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 13 Jun 2011 15:24:52 +0000 Subject: cmake: The cmake files were using the inkscape-version.cpp file generated by autoconfigure. now generate our own. Also remove bad include. (bzr r10289) --- CMakeScripts/inkscape-version.cmake | 30 ++++++++++++++++++++++++++++++ src/CMakeLists.txt | 31 +++++++++++++++++++++++++++++-- src/helper/CMakeLists.txt | 1 - 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 CMakeScripts/inkscape-version.cmake diff --git a/CMakeScripts/inkscape-version.cmake b/CMakeScripts/inkscape-version.cmake new file mode 100644 index 000000000..7e53f710b --- /dev/null +++ b/CMakeScripts/inkscape-version.cmake @@ -0,0 +1,30 @@ +# This is called by cmake as an extermal process from +# ./src/CMakeLists.txt and creates inkscape-version.cpp +# +# These variables are defined by the caller, matching the CMake equivilents. +# - ${INKSCAPE_SOURCE_DIR} +# - ${INKSCAPE_BINARY_DIR} + +# We should extract the version from build.xml +# but for now just hard code +set(INKSCAPE_VERSION "0.48+devel") +set(INKSCAPE_REVISION "unknown") + +if(EXISTS ${INKSCAPE_SOURCE_DIR}/.bzr/) + execute_process(COMMAND + bzr revno ${INKSCAPE_SOURCE_DIR} + OUTPUT_VARIABLE INKSCAPE_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +file(WRITE + ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp.txt + "namespace Inkscape {\n" + " char const *version_string = \"${INKSCAPE_VERSION} ${INKSCAPE_REVISION}\";\n" + "}\n") + +# Copy the file to the final header only if the version changes +# and avoid needless rebuilds +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp.txt + ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e7fe3a11..7fa4e86e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -219,7 +219,6 @@ set(inkscape_SRC ige-mac-menu.c ink-action.cpp ink-comboboxentry-action.cpp - inkscape-version.cpp inkscape.cpp inkscape.rc interface.cpp @@ -491,6 +490,33 @@ if(WIN32) endif() +# ----------------------------------------------------------------------------- +# Generate version file +# ----------------------------------------------------------------------------- + +# a custom target that is always built +add_custom_target( + inkscape_version ALL + DEPENDS ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp) + +# creates inkscape-version.cpp using cmake script +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp + COMMAND ${CMAKE_COMMAND} + -DINKSCAPE_SOURCE_DIR=${CMAKE_SOURCE_DIR} + -DINKSCAPE_BINARY_DIR=${CMAKE_BINARY_DIR} + -P ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake) + +# buildinfo.h is a generated file +set_source_files_properties( + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp + PROPERTIES GENERATED TRUE) + +list(APPEND inkscape_SRC + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp +) + + # ----------------------------------------------------------------------------- # Load in subdirectories # ----------------------------------------------------------------------------- @@ -536,7 +562,6 @@ set(inkscape_SRC ${inkscape_SRC} ) - # ----------------------------------------------------------------------------- # Setup the executable # ----------------------------------------------------------------------------- @@ -546,6 +571,8 @@ add_inkscape_lib(inkscape_LIB "${inkscape_SRC}") # make executable for INKSCAPE add_executable(inkscape ${main_SRC}) +add_dependencies(inkscape inkscape_version) + target_link_libraries(inkscape # order from automake sp_LIB diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index f1069e986..8137487e2 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -37,7 +37,6 @@ set(helper_SRC pixbuf-ops.h png-write.h recthull.h - sp-marshal.h stlport.h stock-items.h unit-menu.h -- cgit v1.2.3