[uchardet: 18/29] cmake: use GNUInstallDirs cmake module
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [uchardet: 18/29] cmake: use GNUInstallDirs cmake module
- Date: Sun, 27 Mar 2016 18:37:57 +0000 (UTC)
commit 31a53570d6f7024c23b0bbc1b22bd5d0f6c37947
Author: Ilya Tumaykin <itumaykin gmail com>
Date: Mon Mar 21 20:40:42 2016 +0300
cmake: use GNUInstallDirs cmake module
Available in cmake >= 2.8.5.
CMakeLists.txt | 37 +++++--------------------------------
doc/CMakeLists.txt | 2 +-
src/CMakeLists.txt | 12 +++++-------
3 files changed, 11 insertions(+), 40 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c50294..edac194 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,43 +29,16 @@ set (
######## Directory
-set (DIR_PREFIX ${CMAKE_INSTALL_PREFIX})
-set (DIR_LIBRARY ${DIR_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX})
-set (DIR_LIBRARY_STATIC ${DIR_PREFIX}/${CMAKE_STATIC_LIBRARY_PREFIX})
-set (DIR_INCLUDE ${DIR_PREFIX}/include)
-set (DIR_SHARE ${DIR_PREFIX}/share)
-set (DIR_ETC ${DIR_PREFIX}/etc)
-
-set (CMAKE_INSTALL_BINDIR bin CACHE STRING "Install location of executables")
-
-if (DEFINED CMAKE_INSTALL_LIBDIR)
- set (DIR_LIBRARY ${CMAKE_INSTALL_LIBDIR})
- set (DIR_LIBRARY_STATIC ${CMAKE_INSTALL_LIBDIR})
-endif (DEFINED CMAKE_INSTALL_LIBDIR)
-
-if (DEFINED SHARE_INSTALL_PREFIX)
- set (DIR_SHARE ${SHARE_INSTALL_PREFIX})
-endif (DEFINED SHARE_INSTALL_PREFIX)
-
-if (DEFINED INCLUDE_INSTALL_DIR)
- set (DIR_INCLUDE ${INCLUDE_INSTALL_DIR})
-endif (DEFINED INCLUDE_INSTALL_DIR)
-
-if (DEFINED SYSCONF_INSTALL_DIR)
- set (DIR_ETC ${SYSCONF_INSTALL_DIR})
-endif (DEFINED SYSCONF_INSTALL_DIR)
-
-set (DIR_SHARE_UCHARDET ${DIR_SHARE}/${PACKAGE_NAME})
-set (DIR_SHARE_LOCALE ${DIR_SHARE}/locale)
+include(GNUInstallDirs)
######## Configuration
-option(BUILD_SHARED_LIBS "Build shared library and link executable against it"
- ON)
+option(BUILD_BINARY "Build executable" ON)
+option(BUILD_SHARED_LIBS "Build shared library and link executable to it" ON)
+
if (BUILD_SHARED_LIBS)
option(BUILD_STATIC "Build static library" ON)
endif (BUILD_SHARED_LIBS)
-option(BUILD_BINARY "Build executable" ON)
configure_file(
uchardet.pc.in
@@ -77,7 +50,7 @@ install(
FILES
${CMAKE_BINARY_DIR}/uchardet.pc
DESTINATION
- ${DIR_LIBRARY}/pkgconfig
+ ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
######## Subdirectories
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index f14354e..10751f8 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -2,5 +2,5 @@ install(
FILES
uchardet.1
DESTINATION
- ${DIR_SHARE}/man/man1
+ ${CMAKE_INSTALL_MANDIR}/man1
)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 95148e4..73c672a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,8 +47,6 @@ if (BUILD_STATIC AND BUILD_SHARED_LIBS)
endif ()
add_definitions(
- -DPKGDATADIR="${DIR_SHARE_UCHARDET}"
- -DLOCALEDIR="${DIR_SHARE_LOCALE}"
-DVERSION="${UCHARDET_VERSION}"
-DPACKAGE_NAME="${PACKAGE_NAME}"
-Wall
@@ -103,9 +101,9 @@ if (NOT WIN32)
TARGETS
${UCHARDET_TARGET}
LIBRARY DESTINATION
- ${DIR_LIBRARY}
+ ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION
- ${DIR_LIBRARY}
+ ${CMAKE_INSTALL_LIBDIR}
)
else (NOT WIN32)
install(
@@ -114,7 +112,7 @@ else (NOT WIN32)
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION
- ${DIR_LIBRARY}
+ ${CMAKE_INSTALL_LIBDIR}
)
endif (NOT WIN32)
@@ -123,7 +121,7 @@ if (UCHARDET_STATIC_TARGET)
TARGETS
${UCHARDET_STATIC_TARGET}
ARCHIVE DESTINATION
- ${DIR_LIBRARY_STATIC}
+ ${CMAKE_INSTALL_LIBDIR}
)
endif (UCHARDET_STATIC_TARGET)
@@ -131,7 +129,7 @@ install(
FILES
${UCHARDET_HEADERS}
DESTINATION
- ${DIR_INCLUDE}/uchardet
+ ${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}
)
include(symbols.cmake)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]