From 6f28b1370e52db0d2a43e4be9f74c662708adea9 Mon Sep 17 00:00:00 2001 From: Justin Hammond Date: Tue, 20 Oct 2015 00:12:00 +0800 Subject: [PATCH] detect CentOS 6 --- CMakeLists.txt | 9 ++++++ dist/CheckLSBTypes.cmake | 64 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 dist/CheckLSBTypes.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cfbc499..42c2020 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required (VERSION 2.8) project (LMBd) +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/dist) +INCLUDE(CheckLSBTypes) + option(LMB_DEBUG "Enable additional debugging information" OFF) @@ -31,6 +34,12 @@ add_executable(LMBd src/LoggerCpp/OutputDebug.cpp src/LoggerCpp/OutputFile.cpp) +if (LSB_DISTRIBUTOR_ID STREQUAL "centos") +if (LSB_RELEASE STREQUAL "6") +message("Enabling CentOS 6 workaround for Boost") +set(Boost_NO_BOOST_CMAKE ON) +endif() +endif() find_package(Boost REQUIRED COMPONENTS thread filesystem) diff --git a/dist/CheckLSBTypes.cmake b/dist/CheckLSBTypes.cmake new file mode 100644 index 0000000..6449f36 --- /dev/null +++ b/dist/CheckLSBTypes.cmake @@ -0,0 +1,64 @@ +# - If included, system dependent information types like lsb_release name, architecture type +# and some other useful information stored for global CMAKE use +# +# !!! The content of these variables should not be used in cross compilation projects !!! +# +# Copyright (C) 2011 by Michael Götting +# +# This program is free software; you can redistribute it +# and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; +# either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +SET(LSB_DISTRIBUTOR_ID "unkown") +SET(LSB_RELEASE "unkown") +SET(LSB_CODENAME "unkown") +SET(LSB_BIT_TYPE "unkown") +SET(LSB_ARCH_TYPE "unkown") + +# ---- (mgoettin 10/17/2011) TODO: Update this to match all OS ---- +SET(LSB_PROCESSOR_ARCH ${CMAKE_SYSTEM_PROCESSOR}) + +# ---- Get the system bit type ---- +IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(LSB_BIT_TYPE 64) +ELSE() + SET(LSB_BIT_TYPE 32) +ENDIF() + +# ---- Get the system LSB data ---- +IF(UNIX) + + FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release) + IF(LSB_RELEASE_EXECUTABLE) + # ---- Get the distribution codename ---- + EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXECUTABLE} -s -c + OUTPUT_VARIABLE TMP_LSB_CODENAME + OUTPUT_STRIP_TRAILING_WHITESPACE) + STRING(TOLOWER ${TMP_LSB_CODENAME} LSB_CODENAME) + # ---- Get the release name ---- + EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXECUTABLE} -s -r + OUTPUT_VARIABLE TMP_LSB_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE) + STRING(TOLOWER ${TMP_LSB_RELEASE} LSB_RELEASE) + # ---- Get the distributor id ---- + EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXECUTABLE} -s -i + OUTPUT_VARIABLE TMP_LSB_DISTRIBUTOR_ID + OUTPUT_STRIP_TRAILING_WHITESPACE) + STRING(TOLOWER ${TMP_LSB_DISTRIBUTOR_ID} LSB_DISTRIBUTOR_ID) + + MESSAGE(STATUS "LSB-Release system information:: + LSB Distributor-ID: ${LSB_DISTRIBUTOR_ID} + LSB Release: ${LSB_RELEASE} + LSB Codename: ${LSB_CODENAME} + System bit type: ${LSB_BIT_TYPE} bit") + + ENDIF(LSB_RELEASE_EXECUTABLE) +ENDIF(UNIX)