[sword-svn] r2824 - trunk/cmake
greg.hellings at crosswire.org
greg.hellings at crosswire.org
Wed Jun 19 07:01:28 MST 2013
Author: greg.hellings
Date: 2013-06-19 07:01:28 -0700 (Wed, 19 Jun 2013)
New Revision: 2824
Modified:
trunk/cmake/install.cmake
trunk/cmake/options.cmake
Log:
Add greater flexibility on install and move more option handling
into the options.cmake file for ease of access.
Modified: trunk/cmake/install.cmake
===================================================================
--- trunk/cmake/install.cmake 2013-06-15 10:32:43 UTC (rev 2823)
+++ trunk/cmake/install.cmake 2013-06-19 14:01:28 UTC (rev 2824)
@@ -2,47 +2,36 @@
# First, install the library itself
#
MESSAGE(STATUS "\n-- CONFIGURING INSTALLATION DESTINATIONS")
-IF(NOT CMAKE_INSTALL_PREFIX)
- IF(APPLE)
- SET(SWORD_INSTALL_DIR "/opt/local")
- ELSEIF(MSVC)
- SET(SWORD_INSTALL_DIR "C:\\Program Files (x86)\\libsword\\")
- ELSE(APPLE)
- SET(SWORD_INSTALL_DIR "/usr/local")
- ENDIF(APPLE)
-ELSE(NOT CMAKE_INSTALL_PREFIX)
- SET(SWORD_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
-ENDIF(NOT CMAKE_INSTALL_PREFIX)
+# 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 ${SWORD_INSTALL_DIR}/lib)
+ DESTINATION "${LIBDIR}")
ENDIF(BUILDING_SHARED)
IF(BUILDING_STATIC)
INSTALL(TARGETS sword_static
- DESTINATION ${SWORD_INSTALL_DIR}/lib)
+ DESTINATION "${LIBDIR}")
ENDIF(BUILDING_STATIC)
# Install the locales
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/locales.d
- DESTINATION ${SWORD_INSTALL_DIR}/share/sword)
+ DESTINATION "${PREFIX}/share/sword")
# Install the headers
INSTALL(FILES ${SWORD_INSTALL_HEADERS}
- DESTINATION "${SWORD_INSTALL_DIR}/include/sword")
+ DESTINATION "${INCLUDEDIR}/sword")
IF(SWORD_INTERNAL_REGEX)
INSTALL(FILES ${INTERNAL_REGEX_HEADER}
- DESTINATION "${SWORD_INSTALL_DIR}/include/sword")
+ DESTINATION "${INCLUDEDIR}/sword")
ENDIF(SWORD_INTERNAL_REGEX)
-MESSAGE(STATUS "Destination: ${SWORD_INSTALL_DIR}")
+MESSAGE(STATUS "Destination: ${PREFIX}")
-# Configuration files, of course
-SET(prefix ${SWORD_INSTALL_DIR})
-SET(exec_prefix ${SWORD_INSTALL_DIR})
-SET(libdir ${SWORD_INSTALL_DIR}/lib)
-SET(includedir ${SWORD_INSTALL_DIR}/include)
SET(VERSION ${SWORD_VERSION})
IF(WITH_CURL)
SET(CURL_LIBS ${CURL_LIBRARY})
@@ -62,11 +51,11 @@
# The @ONLY restricts it because our ${variable} which are left there as part of pkg-config
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sword.pc.in ${CMAKE_CURRENT_BINARY_DIR}/sword.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sword.pc
- DESTINATION "${SWORD_INSTALL_DIR}/lib/pkgconfig")
+ DESTINATION "${LIBDIR}/pkgconfig")
# Need to build/install the
IF(WITH_ICU AND ICU_GENRB)
- ADD_DEFINITIONS(-DSWICU_DATA="${libdir}/sword/${SWORD_VERSION}_icu_${ICU_VERSION}")
+ ADD_DEFINITIONS(-DSWICU_DATA="${LIBDIR}/sword/${SWORD_VERSION}_icu_${ICU_VERSION}")
FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/icu")
FOREACH(translit ${translit_SOURCES})
STRING(REPLACE ".txt" ".res" translit_OUTPUT ${translit})
@@ -90,6 +79,6 @@
ENDIF(BUILDING_SHARED)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/icu/${translit_OUTPUT}"
- DESTINATION "${libdir}/sword/${SWORD_VERSION}_icu_${ICU_VERSION}")
+ DESTINATION "${LIBDIR}/sword/${SWORD_VERSION}_icu_${ICU_VERSION}")
ENDFOREACH(translit ${translit_SOURCES})
ENDIF(WITH_ICU AND ICU_GENRB)
Modified: trunk/cmake/options.cmake
===================================================================
--- trunk/cmake/options.cmake 2013-06-15 10:32:43 UTC (rev 2823)
+++ trunk/cmake/options.cmake 2013-06-19 14:01:28 UTC (rev 2824)
@@ -1,3 +1,21 @@
# A list of the options that the library supports
-OPTION(SWORD_PYTHON_INSTALL_DIR "Directory where the Python bindings will be installed. Defaults to default Python path."
- "")
+SET(SWORD_PYTHON_INSTALL_DIR "" CACHE STRING "Directory where the Python bindings will be installed. Defaults to default Python path.")
+
+# Installation options
+IF(APPLE)
+ SET(SWORD_INSTALL_DIR "/opt/local")
+ELSEIF(MSVC)
+ SET(SWORD_INSTALL_DIR "C:\\Program Files (x86)\\libsword\\")
+ELSE(APPLE)
+ 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)
+ OPTION(PREFIX "${SWORD_INSTALL_DIR}" CACHE STRING "Directory into which to install architecture-dependent files. Defaults to ${SWORD_INSTALL_DIR}")
+ENDIF(CMAKE_INSTALL_PREFIX)
+
+SET(LIBDIR "${PREFIX}/lib" CACHE STRING "Object code library install directory. Defaults to ${CMAKE_INSTALL_PREFIX}/lib")
+
+SET(INCLUDEDIR "${PREFIX}/include" CACHE STRING "C Header files install directory. Defaults to ${CMAKE_INSTALL_PREFIX}/include.")
More information about the sword-cvs
mailing list