summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-16 16:33:38 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-16 16:33:38 +0100
commitc1effc7b4959771c3f0b9d6494637b877594582b (patch)
tree08fe4514b6463bb2590882d15128256338b9e9da
parent04ebbebd22e811b82a7ef1ed3591ce5e2dbfcca3 (diff)
downloadpcitool-c1effc7b4959771c3f0b9d6494637b877594582b.tar.gz
pcitool-c1effc7b4959771c3f0b9d6494637b877594582b.tar.bz2
pcitool-c1effc7b4959771c3f0b9d6494637b877594582b.tar.xz
pcitool-c1effc7b4959771c3f0b9d6494637b877594582b.zip
Use GNUInstallDirs to detect install directories (should fix problems on Debian/Ubuntu)
-rw-r--r--CMakeLists.txt45
1 files changed, 20 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 486e29a..b9fa01d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,32 +14,40 @@ set(DISABLE_SERVERS FALSE CACHE BOOL "Disable Web API support")
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
-if(NOT DEFINED LIB_SUFFIX)
- if (CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(LIB_SUFFIX "64")
- else (CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(LIB_SUFFIX "")
- endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
-endif(NOT DEFINED LIB_SUFFIX)
+
+include(GNUInstallDirs)
+include(CheckIncludeFiles)
+
+include(cmake/tools.cmake)
+include(cmake/version.cmake)
+VERSION_TO_VARS(${PCILIB_VERSION} PCILIB_VERSION_MAJOR PCILIB_VERSION_MINOR PCILIB_VERSION_MICRO)
+
+set(EXTRA_SYSTEM_LIBS -lrt)
+add_definitions("-fPIC --std=c99 -Wall -O2 -gdwarf-2 -g3 -fno-omit-frame-pointer")
+#add_definitions("-fPIC --std=c99 -Wall -O2")
+
+find_package(PkgConfig REQUIRED)
+find_package(Threads REQUIRED)
+find_package(Doxygen)
if(NOT DEFINED BIN_INSTALL_DIR)
- set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
+ 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_PREFIX}/lib${LIB_SUFFIX}")
+ 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_PREFIX}/include")
+ 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_PREFIX}/share")
+ 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}/locale")
+ set(LOCALE_INSTALL_DIR "${DATA_INSTALL_DIR}/${CMAKE_INSTALL_LOCALEDIR}")
endif(NOT DEFINED LOCALE_INSTALL_DIR)
if (NOT DEFINED PCILIB_PLUGIN_DIR)
@@ -68,18 +76,6 @@ endif (NOT DEFINED PCILIB_DEBUG_DIR)
SET(ENV{PKG_CONFIG_PATH} "${LIB_INSTALL_DIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
-set(EXTRA_SYSTEM_LIBS -lrt)
-add_definitions("-fPIC --std=c99 -Wall -O2 -gdwarf-2 -g3 -fno-omit-frame-pointer")
-#add_definitions("-fPIC --std=c99 -Wall -O2")
-
-include(cmake/tools.cmake)
-include(cmake/version.cmake)
-VERSION_TO_VARS(${PCILIB_VERSION} PCILIB_VERSION_MAJOR PCILIB_VERSION_MINOR PCILIB_VERSION_MICRO)
-
-find_package(PkgConfig REQUIRED)
-find_package(Threads REQUIRED)
-find_package(Doxygen)
-
if (NOT DISABLE_PYTHON)
set(PYTHON_VERSION 2.7 CACHE STRING "python version")
@@ -110,7 +106,6 @@ if (NOT HAVE_PYTHON)
set(DISABLE_SERVERS TRUE)
endif (NOT HAVE_PYTHON)
-include(CheckIncludeFiles)
check_include_files(stdatomic.h HAVE_STDATOMIC_H)
find_path(UTHASH_INCLUDE_DIRS uthash.h PATH_SUFFIXES uthash)