[sword-svn] r3302 - in branches/sword-1-7-x: . cmake utilities

greg.hellings at crosswire.org greg.hellings at crosswire.org
Wed Dec 10 22:22:12 MST 2014


Author: greg.hellings
Date: 2014-12-10 22:22:12 -0700 (Wed, 10 Dec 2014)
New Revision: 3302

Modified:
   branches/sword-1-7-x/
   branches/sword-1-7-x/CMakeLists.txt
   branches/sword-1-7-x/cmake/install.cmake
   branches/sword-1-7-x/cmake/options.cmake
   branches/sword-1-7-x/utilities/CMakeLists.txt
Log:
Merging r3300



Property changes on: branches/sword-1-7-x
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198-3199,3202-3203,3225,3230,3232-3234,3236,3238-3239,3242,3244,3256-3257,3272-3274,3289,3299
   + /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198-3199,3202-3203,3225,3230,3232-3234,3236,3238-3239,3242,3244,3256-3257,3272-3274,3289,3299-3300

Modified: branches/sword-1-7-x/CMakeLists.txt
===================================================================
--- branches/sword-1-7-x/CMakeLists.txt	2014-12-11 05:21:46 UTC (rev 3301)
+++ branches/sword-1-7-x/CMakeLists.txt	2014-12-11 05:22:12 UTC (rev 3302)
@@ -1,10 +1,6 @@
 # TODO: write FindICU (icu-config only for 2.2 and up) -- currently taken from another CMake system
 #       limit pkg-config version to >= 0.14, demo, utilities, doc, tests
-#       use SYSCONF_INSTALL_DIR
-#       use LIB_INSTALL_DIR
-#       use INCLUDE_INSTALL_DIR
 #       use BUILD_SHARED_LIBS
-#       actually install sword.conf when asked
 #       convince perl swig bindings to build properly
 #
 # NOTES: Defaults to build type of Shared
@@ -16,9 +12,6 @@
 # of their own GPLv2 license and all copyright is transferred to them for
 # all posterity and eternity, wherever such transfer is possible.  Where it is
 # not, then this file is released under the GPLv2 by myself.
-#
-#
-# A CMake port of the SWORD build system... we hope
 PROJECT(libsword CXX C)
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
 SET(SWORD_VERSION 1.7.3.900)
@@ -119,12 +112,12 @@
 ################################################################################################
 # Some random user settings
 #
+ADD_DEFINITIONS(-DGLOBCONFPATH="${SYSCONF_INSTALL_DIR}/sword.conf")
+SET(CONFFILE "[Install]
+DataPath=${SHARE_INSTALL_PREFIX}/sword")
+FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sword.conf" "${CONFFILE}")
 
-IF(NOT SWORD_GLOBAL_CONF_DIR STREQUAL "")
-	ADD_DEFINITIONS(-DGLOBCONFPATH="${SWORD_GLOBAL_CONF_DIR}/sword.conf")
-ENDIF(NOT SWORD_GLOBAL_CONF_DIR STREQUAL "")
 
-
 ###############################################################################################
 # This allows the user to set a SONAME for the library.  This allows packagers and those who
 # care about that sort of thing to be happy and have all their SONAMES set properly.

Modified: branches/sword-1-7-x/cmake/install.cmake
===================================================================
--- branches/sword-1-7-x/cmake/install.cmake	2014-12-11 05:21:46 UTC (rev 3301)
+++ branches/sword-1-7-x/cmake/install.cmake	2014-12-11 05:22:12 UTC (rev 3302)
@@ -3,34 +3,39 @@
 # 
 MESSAGE(STATUS "\n-- CONFIGURING INSTALLATION DESTINATIONS")
 # Configuration files, of course
-SET(prefix 		"${PREFIX}")
-SET(exec_prefix 	"${PREFIX}")
-SET(libdir              "${LIBDIR}")
-SET(includedir 		"${INCLUDEDIR}")
 
 # Install the library
 IF(BUILDING_SHARED)
 	INSTALL(TARGETS sword
-		DESTINATION "${LIBDIR}")
+        RUNTIME DESTINATION "${BINDIR}"
+        LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
+        ARCHIVE DESTINATION "${LIB_INSTALL_DIR}")
 ENDIF(BUILDING_SHARED)
 IF(BUILDING_STATIC)
 	INSTALL(TARGETS sword_static
-		DESTINATION "${LIBDIR}")
+        RUNTIME DESTINATION "${BINDIR}"
+        LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
+        ARCHIVE DESTINATION "${LIB_INSTALL_DIR}")
 ENDIF(BUILDING_STATIC)
 # Install the locales
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/locales.d
-	DESTINATION "${PREFIX}/share/sword")
+    DESTINATION "${SHARE_INSTALL_PREFIX}/sword")
 
 # Install the headers
 INSTALL(FILES ${SWORD_INSTALL_HEADERS}
-	DESTINATION "${INCLUDEDIR}/sword")
+    DESTINATION "${INCLUDE_INSTALL_DIR}/sword")
+# Install sysconf file
+INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/sword.conf"
+    DESTINATION "${SYSCONF_INSTALL_DIR}")
+# Create the mods.d
+INSTALL(DIRECTORY DESTINATION "${SHARE_INSTALL_PREFIX}/sword/mods.d")
 
 IF(SWORD_INTERNAL_REGEX)
 	INSTALL(FILES ${INTERNAL_REGEX_HEADER}
-		DESTINATION "${INCLUDEDIR}/sword")
+        DESTINATION "${INCLUDE_INSTALL_DIR}/sword")
 ENDIF(SWORD_INTERNAL_REGEX)
 
-MESSAGE(STATUS "Destination: ${PREFIX}")
+MESSAGE(STATUS "Destination: ${CMAKE_INSTALL_PREFIX}")
 
 SET(VERSION		${SWORD_VERSION})
 IF(WITH_CURL)
@@ -49,8 +54,12 @@
 	SET(SHAREDLIB_FALSE "#")
 ENDIF(LIBSWORD_LIBRARY_TYPE STREQUAL "Static")
 # The @ONLY restricts it because our ${variable} which are left there as part of pkg-config
+SET(prefix ${CMAKE_INSTALL_PREFIX})
+SET(libdir ${LIB_INSTALL_DIR})
+SET(exec_prefix ${BINDIR})
+SET(includedir ${INCLUDE_INSTALL_DIR})
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sword.pc.in ${CMAKE_CURRENT_BINARY_DIR}/sword.pc @ONLY)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/include/swversion.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/swversion.h @ONLY)
 
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sword.pc
-	DESTINATION "${LIBDIR}/pkgconfig")
+    DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")

Modified: branches/sword-1-7-x/cmake/options.cmake
===================================================================
--- branches/sword-1-7-x/cmake/options.cmake	2014-12-11 05:21:46 UTC (rev 3301)
+++ branches/sword-1-7-x/cmake/options.cmake	2014-12-11 05:22:12 UTC (rev 3302)
@@ -1,3 +1,27 @@
+# Borrowed
+#
+# This macro implements some very special logic how to deal with the cache.
+# By default the various install locations inherit their value from their "parent" variable
+# so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will
+# calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX .
+# This would work completely without using the cache.
+# But if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into
+# the cache, otherwise it will be forgotten on the next cmake run.
+# Once a variable is in the cache, it doesn't depend on its "parent" variables
+# anymore and you can only change it by editing it directly.
+# this macro helps in this regard, because as long as you don't set one of the
+# variables explicitely to some location, it will always calculate its value from its
+# parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect.
+# But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location
+# this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX.
+macro(_SET_FANCY _var _value _comment)
+    if (NOT DEFINED ${_var})
+        set(${_var} ${_value})
+    else()
+        set(${_var} "${${_var}}" CACHE STRING "${_comment}")
+    endif()
+endmacro(_SET_FANCY)
+
 # A list of the options that the library supports
 SET(SWORD_PYTHON_INSTALL_DIR "" CACHE STRING "Directory where the Python bindings will be installed. Defaults to default Python path.")
 
@@ -10,18 +34,18 @@
 	SET(SWORD_INSTALL_DIR "/usr/local")
 ENDIF(APPLE)
 
-IF(CMAKE_INSTALL_PREFIX)
-	SET(PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Directory into which to install architecture-dependent files. Defaults to ${SWORD_INSTALL_DIR}.")
-ELSE(CMAKE_INSTALL_PREFIX)
-	SET(PREFIX "${SWORD_INSTALL_DIR}" CACHE STRING "Directory into which to install architecture-dependent files. Defaults to ${SWORD_INSTALL_DIR}")
-ENDIF(CMAKE_INSTALL_PREFIX)
+_SET_FANCY(CMAKE_INSTALL_PREFIX "${SWORD_INSTALL_DIR}" "Directory into which to install architecture-dependent files. Defaults to ${SWORD_INSTALL_DIR}.")
 
-SET(LIBDIR "${PREFIX}/lib" CACHE STRING "Object code library install directory. Defaults to ${SWORD_INSTALL_DIR}/lib")
+_SET_FANCY(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" "Object code library install directory. Defaults to ${SWORD_INSTALL_DIR}/lib")
 
-SET(INCLUDEDIR "${PREFIX}/include" CACHE STRING "C Header files install directory. Defaults to ${SWORD_INSTALL_DIR}/include.")
+_SET_FANCY(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "C Header files install directory. Defaults to ${SWORD_INSTALL_DIR}/include.")
 
-SET(BINDIR "${PREFIX}/bin" CACHE STRING "Directory to install binary executable files. Defaults to ${SWORD_INSTALL_DIR}/bin.")
+SET(BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "Directory to install binary executable files. Defaults to ${SWORD_INSTALL_DIR}/bin.")
 
+_SET_FANCY(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "Directory to install global config files. Defaults to ${SWORD_INSTALL_DIR}/etc.")
+
+_SET_FANCY(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Directory to install global data files. Defaults to ${SWORD_INSTALL_DIR}/share.")
+
 # Post-processing of variables
 MACRO(PROCESS_VERSION LEVEL VALUE)
     SET(SWORD_VERSION_${LEVEL} ${VALUE})

Modified: branches/sword-1-7-x/utilities/CMakeLists.txt
===================================================================
--- branches/sword-1-7-x/utilities/CMakeLists.txt	2014-12-11 05:21:46 UTC (rev 3301)
+++ branches/sword-1-7-x/utilities/CMakeLists.txt	2014-12-11 05:22:12 UTC (rev 3302)
@@ -88,7 +88,7 @@
 # 
 FOREACH(UTIL ${install_UTILITIES})
 	INSTALL(TARGETS ${UTIL}
-		DESTINATION ${BINDIR}
+        RUNTIME DESTINATION "${BINDIR}"
 		COMPONENT utilities
 	)
 ENDFOREACH(UTIL ${install_UTILITIES})
@@ -113,7 +113,7 @@
 	TARGET_LINK_LIBRARIES(diatheke sword_static)
 ENDIF(BUILDING_SHARED)
 INSTALL(TARGETS diatheke
-	DESTINATION ${BINDIR}
+	DESTINATION "${BINDIR}"
 	COMPONENT utilities
 )
 




More information about the sword-cvs mailing list