summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-16 20:06:34 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-16 20:06:34 +0100
commit142a1a83472d4dde6e7fdc58a46c6800505f44ab (patch)
tree2e43f3a0435a7e2f69a3f7581b20261ec2f70783
parentc1effc7b4959771c3f0b9d6494637b877594582b (diff)
downloadpcitool-142a1a83472d4dde6e7fdc58a46c6800505f44ab.tar.gz
pcitool-142a1a83472d4dde6e7fdc58a46c6800505f44ab.tar.bz2
pcitool-142a1a83472d4dde6e7fdc58a46c6800505f44ab.tar.xz
pcitool-142a1a83472d4dde6e7fdc58a46c6800505f44ab.zip
Use GNUInstallDirs
-rw-r--r--CMakeLists.txt36
-rw-r--r--misc/pcitool.pc.in10
-rw-r--r--pcilib/CMakeLists.txt2
-rw-r--r--pcitool.spec.in4
-rw-r--r--pcitool/CMakeLists.txt6
-rw-r--r--pywrap/CMakeLists.txt6
6 files changed, 21 insertions, 43 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9fa01d..7ae801e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,32 +30,12 @@ find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
find_package(Doxygen)
-if(NOT DEFINED BIN_INSTALL_DIR)
- set(BIN_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}")
-endif(NOT DEFINED BIN_INSTALL_DIR)
-
-if(NOT DEFINED LIB_INSTALL_DIR)
- set(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
-endif(NOT DEFINED LIB_INSTALL_DIR)
-
-if(NOT DEFINED INCLUDE_INSTALL_DIR)
- set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
-endif(NOT DEFINED INCLUDE_INSTALL_DIR)
-
-if(NOT DEFINED DATA_INSTALL_DIR)
- set(DATA_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}")
-endif(NOT DEFINED DATA_INSTALL_DIR)
-
-if(NOT DEFINED LOCALE_INSTALL_DIR)
- set(LOCALE_INSTALL_DIR "${DATA_INSTALL_DIR}/${CMAKE_INSTALL_LOCALEDIR}")
-endif(NOT DEFINED LOCALE_INSTALL_DIR)
-
if (NOT DEFINED PCILIB_PLUGIN_DIR)
- set(PCILIB_PLUGIN_DIR "${LIB_INSTALL_DIR}/pcilib" CACHE PATH "Directory to install plugins")
+ set(PCILIB_PLUGIN_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/pcilib" CACHE PATH "Directory to install plugins")
endif (NOT DEFINED PCILIB_PLUGIN_DIR)
if (NOT DEFINED PCILIB_DATA_DIR)
- set(PCILIB_DATA_DIR "${DATA_INSTALL_DIR}/pcilib" CACHE PATH "Directory to install data files")
+ set(PCILIB_DATA_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/pcilib" CACHE PATH "Directory to install data files")
endif (NOT DEFINED PCILIB_DATA_DIR)
if (NOT DEFINED PCILIB_MODEL_DIR)
@@ -74,7 +54,7 @@ if (NOT DEFINED PCILIB_DEBUG_DIR)
set(PCILIB_DEBUG_DIR "." CACHE PATH "Directory to write debug information")
endif (NOT DEFINED PCILIB_DEBUG_DIR)
-SET(ENV{PKG_CONFIG_PATH} "${LIB_INSTALL_DIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+SET(ENV{PKG_CONFIG_PATH} "${CMAKE_INSTALL_LIBDIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
if (NOT DISABLE_PYTHON)
set(PYTHON_VERSION 2.7 CACHE STRING "python version")
@@ -87,17 +67,17 @@ if (NOT DISABLE_PYTHON)
message (FATAL_ERROR "Version mismatch between python interpreter and libraries")
endif (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING)
-# execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "from sysconfig import get_path; print get_path('platlib')" OUTPUT_VARIABLE PYTHON_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
+# execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "from sysconfig import get_path; print get_path('platlib')" OUTPUT_VARIABLE PCILIB_PYTHON_SITEDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (NOT DEFINED PYTHON_INSTALL_DIR)
+ if (NOT DEFINED PCILIB_PYTHON_SITEDIR)
execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print (site.PREFIXES[-1])" OUTPUT_VARIABLE PYTHON_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
file (TO_CMAKE_PATH "${PYTHON_PREFIX}" PYTHON_PREFIX)
execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import site; print (site.getsitepackages()[0])" OUTPUT_VARIABLE PYTHON_SITE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
file (TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR)
string (REGEX REPLACE "^${PYTHON_PREFIX}/" "${CMAKE_INSTALL_PREFIX}/" PYTHON_SITE_DIR "${PYTHON_SITE_DIR}")
- set(PYTHON_INSTALL_DIR ${PYTHON_SITE_DIR} CACHE PATH "path to install python module")
- endif (NOT DEFINED PYTHON_INSTALL_DIR)
+ set(PCILIB_PYTHON_SITEDIR ${PYTHON_SITE_DIR} CACHE PATH "path to install python module")
+ endif (NOT DEFINED PCILIB_PYTHON_SITEDIR)
set(HAVE_PYTHON TRUE)
endif (NOT DISABLE_PYTHON)
@@ -145,7 +125,7 @@ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "docs/html")
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/misc/pcitool.pc
- DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
if (NOT DISABLE_SERVERS)
diff --git a/misc/pcitool.pc.in b/misc/pcitool.pc.in
index 7261c5f..d682f75 100644
--- a/misc/pcitool.pc.in
+++ b/misc/pcitool.pc.in
@@ -1,12 +1,12 @@
prefix=${CMAKE_INSTALL_PREFIX}
-exec_prefix=${BIN_INSTALL_DIR}
-libdir=${LIB_INSTALL_DIR}
-includedir=${INCLUDE_INSTALL_DIR}
+exec_prefix=${CMAKE_INSTALL_BINDIR}
+libdir=${CMAKE_INSTALL_LIBDIR}
+includedir=${CMAKE_INSTALL_INCLUDEDIR}
plugindir=${PCILIB_PLUGIN_DIR}
modeldir=${PCILIB_MODEL_DIR}
Name: ${TARNAME}
Description: User-space library to handle PCIe-devices
Version: ${PACKAGE_VERSION}
-Libs: -L${LIB_INSTALL_DIR} -lpcilib
-Cflags: -I${INCLUDE_INSTALL_DIR}
+Libs: -L${CMAKE_INSTALL_LIBDIR} -lpcilib
+Cflags: -I${CMAKE_INSTALL_INCLUDEDIR}
diff --git a/pcilib/CMakeLists.txt b/pcilib/CMakeLists.txt
index 009357e..2af60b4 100644
--- a/pcilib/CMakeLists.txt
+++ b/pcilib/CMakeLists.txt
@@ -14,7 +14,7 @@ target_link_libraries(pcilib dma protocols views ${CMAKE_THREAD_LIBS_INIT} ${UFO
add_dependencies(pcilib dma protocols views)
install(TARGETS pcilib
- LIBRARY DESTINATION lib${LIB_SUFFIX}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(FILES pcilib.h
diff --git a/pcitool.spec.in b/pcitool.spec.in
index 8de8002..ddae001 100644
--- a/pcitool.spec.in
+++ b/pcitool.spec.in
@@ -119,7 +119,9 @@ Pcilib Web API and small demo web server.
%build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DPCILIB_PLUGIN_DIR=%{_libdir}/pcilib${PCILIB_ABI_VERSION}/ -DPCILIB_DATA_DIR=%{_datadir}/pcilib${PCILIB_ABI_VERSION}/ \
- -DLIB_INSTALL_DIR=%{_libdir} -DBIN_INSTALL_DIR=%{_bindir} -DDATA_INSTALL_DIR=%{_datadir} -DINCLUDE_INSTALL_DIR=%{_includedir} -DPYTHON_INSTALL_DIR=%{python2_sitearch} .
+ -DPCILIB_PYTHON_SITEDIR=%{python2_sitearch} \
+ -DCMAKE_INSTALL_LIBDIR=%{_libdir} -DCMAKE_INSTALL_BINDIR=%{_bindir} -DCMAKE_INSTALL_DATADIR=%{_datadir} -DCMAKE_INSTALL_DATAROOTDIR=%{_datadir} -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} .
+
make
make docs
diff --git a/pcitool/CMakeLists.txt b/pcitool/CMakeLists.txt
index af0f6e4..6bd7ba1 100644
--- a/pcitool/CMakeLists.txt
+++ b/pcitool/CMakeLists.txt
@@ -25,11 +25,7 @@ if (NOT DISABLE_PCITOOL)
# LINK_FLAGS "-Wl,pcitool/libpcitool.a"
#)
- if(NOT DEFINED BIN_INSTALL_DIR)
- set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
- endif(NOT DEFINED BIN_INSTALL_DIR)
-
install(TARGETS pci
- DESTINATION ${BIN_INSTALL_DIR}
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif (NOT DISABLE_PCITOOL)
diff --git a/pywrap/CMakeLists.txt b/pywrap/CMakeLists.txt
index 5acd17a..1417a04 100644
--- a/pywrap/CMakeLists.txt
+++ b/pywrap/CMakeLists.txt
@@ -17,9 +17,9 @@ set(CMAKE_SWIG_FLAGS "")
swig_add_module(pcipywrap python pcipywrap.i pcipywrap.c)
swig_link_libraries(pcipywrap ${PYTHON_LIBRARIES} pcilib)
-install(TARGETS ${SWIG_MODULE_pcipywrap_REAL_NAME} DESTINATION ${PYTHON_INSTALL_DIR})
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pcipywrap.py DESTINATION ${PYTHON_INSTALL_DIR})
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcilib.py DESTINATION ${PYTHON_INSTALL_DIR})
+install(TARGETS ${SWIG_MODULE_pcipywrap_REAL_NAME} DESTINATION ${PCILIB_PYTHON_SITEDIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pcipywrap.py DESTINATION ${PCILIB_PYTHON_SITEDIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcilib.py DESTINATION ${PCILIB_PYTHON_SITEDIR})
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test_pcilib.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})