2009-12-08 05:17:58 +00:00
|
|
|
# vim: ts=4 sw=4 noet ai cindent syntax=cmake
|
2010-01-01 23:49:41 +00:00
|
|
|
#
|
|
|
|
# Conky, a system monitor, based on torsmo
|
|
|
|
#
|
|
|
|
# Please see COPYING for details
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005-2010 Brenden Matthews, et. al. (see AUTHORS)
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# 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 3 of the License, 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.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
2009-12-08 05:17:58 +00:00
|
|
|
|
2015-06-22 00:53:16 +00:00
|
|
|
#set(RELEASE true)
|
2015-06-22 00:49:06 +00:00
|
|
|
|
2009-12-08 05:17:58 +00:00
|
|
|
# Set system vars
|
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
set(OS_LINUX true)
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
|
|
set(OS_FREEBSD true)
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
|
|
|
2012-06-28 16:56:01 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly")
|
|
|
|
set(OS_DRAGONFLY true)
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "DragonFly")
|
|
|
|
|
2009-12-08 05:17:58 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
|
|
|
set(OS_OPENBSD true)
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
|
|
|
|
2018-01-19 14:00:42 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
2009-12-08 05:17:58 +00:00
|
|
|
set(OS_SOLARIS true)
|
2018-01-19 14:00:42 +00:00
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
2009-12-08 05:17:58 +00:00
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
|
|
|
set(OS_NETBSD true)
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
|
|
|
|
2018-01-19 16:36:40 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Haiku")
|
|
|
|
set(OS_HAIKU true)
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "Haiku")
|
|
|
|
|
2018-01-19 14:00:42 +00:00
|
|
|
if(NOT OS_LINUX AND NOT OS_FREEBSD AND NOT OS_OPENBSD AND NOT OS_DRAGONFLY
|
2018-01-19 16:36:40 +00:00
|
|
|
AND NOT OS_SOLARIS AND NOT OS_HAIKU)
|
2009-12-08 05:17:58 +00:00
|
|
|
message(FATAL_ERROR "Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported. Patches are welcome.")
|
2018-01-19 14:00:42 +00:00
|
|
|
endif(NOT OS_LINUX AND NOT OS_FREEBSD AND NOT OS_OPENBSD AND NOT OS_DRAGONFLY
|
2018-01-19 16:36:40 +00:00
|
|
|
AND NOT OS_SOLARIS AND NOT OS_HAIKU)
|
2009-12-08 05:17:58 +00:00
|
|
|
|
|
|
|
include(FindThreads)
|
|
|
|
find_package(Threads)
|
|
|
|
|
|
|
|
set(conky_libs ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
set(conky_includes ${CMAKE_BINARY_DIR})
|
|
|
|
|
2012-07-20 18:59:07 +00:00
|
|
|
add_definitions(-D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L) # Standard definitions
|
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS
|
|
|
|
"${CMAKE_REQUIRED_DEFINITIONS} -D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L")
|
2012-07-05 14:41:58 +00:00
|
|
|
|
2012-07-05 08:15:22 +00:00
|
|
|
if(OS_DRAGONFLY)
|
|
|
|
set(conky_libs ${conky_libs} -L/usr/pkg/lib)
|
|
|
|
set(conky_includes ${conky_includes} -I/usr/pkg/include)
|
|
|
|
endif(OS_DRAGONFLY)
|
|
|
|
|
2018-01-19 14:00:42 +00:00
|
|
|
if(OS_SOLARIS)
|
|
|
|
set(conky_libs ${conky_libs} -L/usr/local/lib)
|
|
|
|
endif(OS_SOLARIS)
|
|
|
|
|
2009-12-08 05:17:58 +00:00
|
|
|
# Do version stuff
|
2015-05-23 16:30:53 +00:00
|
|
|
set(VERSION_MAJOR "1")
|
|
|
|
set(VERSION_MINOR "10")
|
2018-01-19 14:16:18 +00:00
|
|
|
set(VERSION_PATCH "8")
|
2009-12-08 05:17:58 +00:00
|
|
|
|
2015-07-23 11:15:58 +00:00
|
|
|
find_program(APP_AWK awk)
|
|
|
|
if(NOT APP_AWK)
|
|
|
|
message(FATAL_ERROR "Unable to find program 'awk'")
|
|
|
|
endif(NOT APP_AWK)
|
2009-12-08 05:17:58 +00:00
|
|
|
|
|
|
|
find_program(APP_WC wc)
|
|
|
|
if(NOT APP_WC)
|
|
|
|
message(FATAL_ERROR "Unable to find program 'wc'")
|
|
|
|
endif(NOT APP_WC)
|
|
|
|
|
|
|
|
find_program(APP_DATE date)
|
|
|
|
if(NOT APP_DATE)
|
|
|
|
message(FATAL_ERROR "Unable to find program 'date'")
|
|
|
|
endif(NOT APP_DATE)
|
|
|
|
|
|
|
|
find_program(APP_UNAME uname)
|
|
|
|
if(NOT APP_UNAME)
|
|
|
|
message(FATAL_ERROR "Unable to find program 'uname'")
|
|
|
|
endif(NOT APP_UNAME)
|
|
|
|
|
|
|
|
if(NOT RELEASE)
|
|
|
|
find_program(APP_GIT git)
|
|
|
|
if(NOT APP_GIT)
|
|
|
|
message(FATAL_ERROR "Unable to find program 'git'")
|
|
|
|
endif(NOT APP_GIT)
|
|
|
|
mark_as_advanced(APP_GIT)
|
|
|
|
endif(NOT RELEASE)
|
|
|
|
|
2015-07-23 11:15:58 +00:00
|
|
|
mark_as_advanced(APP_AWK APP_WC APP_DATE APP_UNAME)
|
2010-01-03 07:59:24 +00:00
|
|
|
|
2009-12-08 05:17:58 +00:00
|
|
|
#BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date)
|
|
|
|
#BUILD_ARCH="$(uname -sr) ($(uname -m))"
|
|
|
|
execute_process(COMMAND ${APP_DATE} RESULT_VARIABLE RETVAL OUTPUT_VARIABLE
|
|
|
|
BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(COMMAND ${APP_UNAME} -srm RESULT_VARIABLE RETVAL
|
|
|
|
OUTPUT_VARIABLE BUILD_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
if(RELEASE)
|
|
|
|
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
|
|
|
else(RELEASE)
|
|
|
|
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_pre${COMMIT_COUNT}")
|
|
|
|
endif(RELEASE)
|
|
|
|
|
2015-06-22 00:49:06 +00:00
|
|
|
set(COPYRIGHT "Copyright Brenden Matthews, et al, 2005-2015")
|
2009-12-08 05:17:58 +00:00
|
|
|
|
2011-09-30 21:01:24 +00:00
|
|
|
macro(AC_SEARCH_LIBS FUNCTION_NAME INCLUDES TARGET_VAR)
|
|
|
|
if("${TARGET_VAR}" MATCHES "^${TARGET_VAR}$")
|
|
|
|
unset(AC_SEARCH_LIBS_TMP CACHE)
|
|
|
|
check_symbol_exists(${FUNCTION_NAME} ${INCLUDES} AC_SEARCH_LIBS_TMP)
|
|
|
|
if(${AC_SEARCH_LIBS_TMP})
|
|
|
|
set(${TARGET_VAR} "" CACHE INTERNAL "Library containing ${FUNCTION_NAME}")
|
2012-07-20 16:09:35 +00:00
|
|
|
else(${AC_SEARCH_LIBS_TMP})
|
|
|
|
foreach(LIB ${ARGN})
|
|
|
|
unset(AC_SEARCH_LIBS_TMP CACHE)
|
|
|
|
unset(AC_SEARCH_LIBS_FOUND CACHE)
|
|
|
|
find_library(AC_SEARCH_LIBS_TMP ${LIB})
|
|
|
|
check_library_exists(${LIB} ${FUNCTION_NAME} ${AC_SEARCH_LIBS_TMP}
|
|
|
|
AC_SEARCH_LIBS_FOUND)
|
|
|
|
if(${AC_SEARCH_LIBS_FOUND})
|
|
|
|
set(${TARGET_VAR} ${AC_SEARCH_LIBS_TMP} CACHE INTERNAL
|
|
|
|
"Library containing ${FUNCTION_NAME}")
|
|
|
|
break()
|
|
|
|
endif(${AC_SEARCH_LIBS_FOUND})
|
|
|
|
endforeach(LIB)
|
2011-09-30 21:01:24 +00:00
|
|
|
endif(${AC_SEARCH_LIBS_TMP})
|
|
|
|
endif("${TARGET_VAR}" MATCHES "^${TARGET_VAR}$")
|
|
|
|
endmacro(AC_SEARCH_LIBS)
|