cmake: switch cmake commands to lowercase

This commit is contained in:
Michael Gehring 2008-06-23 13:31:18 +02:00 committed by Julien Danjou
parent 6f8aa30b2f
commit d08f746733
2 changed files with 205 additions and 203 deletions

View File

@ -1,35 +1,35 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7) cmake_minimum_required(VERSION 2.4.7)
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
SET(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
IF(NOT EXISTS ${SOURCE_DIR}/awesomeConfig.cmake) if(NOT EXISTS ${SOURCE_DIR}/awesomeConfig.cmake)
MESSAGE(FATAL_ERROR "Please provide awesomeConfig.cmake") message(FATAL_ERROR "Please provide awesomeConfig.cmake")
ENDIF() endif()
INCLUDE(awesomeConfig.cmake) include(awesomeConfig.cmake)
INCLUDE_DIRECTORIES(${SOURCE_DIR} include_directories(${SOURCE_DIR}
${BUILD_DIR} ${BUILD_DIR}
${AWESOME_REQUIRED_INCLUDE_DIRS} ${AWESOME_REQUIRED_INCLUDE_DIRS}
${AWESOME_OPTIONAL_INCLUDE_DIRS}) ${AWESOME_OPTIONAL_INCLUDE_DIRS})
SET(AWE_LUA_FILES set(AWE_LUA_FILES
${SOURCE_DIR}/lib/tabulous.lua ${SOURCE_DIR}/lib/tabulous.lua
${SOURCE_DIR}/lib/awful.lua) ${SOURCE_DIR}/lib/awful.lua)
SET(AWE_CONF_FILES ${BUILD_DIR}/awesomerc.lua) set(AWE_CONF_FILES ${BUILD_DIR}/awesomerc.lua)
SET(AWE_ICON_DIR ${SOURCE_DIR}/icons) set(AWE_ICON_DIR ${SOURCE_DIR}/icons)
SET(AWE_DOC_FILES set(AWE_DOC_FILES
${SOURCE_DIR}/AUTHORS ${SOURCE_DIR}/AUTHORS
${SOURCE_DIR}/BUGS ${SOURCE_DIR}/BUGS
${SOURCE_DIR}/README ${SOURCE_DIR}/README
${SOURCE_DIR}/LICENSE) ${SOURCE_DIR}/LICENSE)
SET(AWE_SRCS set(AWE_SRCS
${SOURCE_DIR}/awesome.c ${SOURCE_DIR}/awesome.c
${SOURCE_DIR}/client.c ${SOURCE_DIR}/client.c
${SOURCE_DIR}/cnode.c ${SOURCE_DIR}/cnode.c
@ -75,34 +75,36 @@ SET(AWE_SRCS
${SOURCE_DIR}/widgets/textbox.c ${SOURCE_DIR}/widgets/textbox.c
${SOURCE_DIR}/widgets/systray.c) ${SOURCE_DIR}/widgets/systray.c)
SET(AWE_CLIENT_SRCS set(AWE_CLIENT_SRCS
${SOURCE_DIR}/awesome-client.c ${SOURCE_DIR}/awesome-client.c
${SOURCE_DIR}/common/socket.c ${SOURCE_DIR}/common/socket.c
${SOURCE_DIR}/common/util.c ${SOURCE_DIR}/common/util.c
${SOURCE_DIR}/common/version.c) ${SOURCE_DIR}/common/version.c)
SET(AWE_MAN_SRCS set(AWE_MAN_SRCS
${SOURCE_DIR}/awesome.1.txt ${SOURCE_DIR}/awesome.1.txt
${SOURCE_DIR}/awesome-client.1.txt ${SOURCE_DIR}/awesome-client.1.txt
${SOURCE_DIR}/awesomerc.5.txt) ${SOURCE_DIR}/awesomerc.5.txt)
ADD_EXECUTABLE(${PROJECT_AWE_NAME} ${AWE_SRCS} add_executable(${PROJECT_AWE_NAME}
${AWE_SRCS}
${BUILD_DIR}/common/tokenize.c) ${BUILD_DIR}/common/tokenize.c)
ADD_EXECUTABLE(${PROJECT_AWECLIENT_NAME} ${AWE_CLIENT_SRCS} add_executable(${PROJECT_AWECLIENT_NAME}
${CMAKE_CURRENT_BINARY_DIR}/common/tokenize.c) ${AWE_CLIENT_SRCS}
${BUILD_DIR}/common/tokenize.c)
TARGET_LINK_LIBRARIES(${PROJECT_AWE_NAME} target_link_libraries(${PROJECT_AWE_NAME}
${AWESOME_REQUIRED_LIBRARIES} ${AWESOME_REQUIRED_LIBRARIES}
${AWESOME_OPTIONAL_LIBRARIES}) ${AWESOME_OPTIONAL_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT_AWECLIENT_NAME} target_link_libraries(${PROJECT_AWECLIENT_NAME}
${LIB_READLINE} ${LIB_READLINE}
${LIB_NCURSES}) ${LIB_NCURSES})
# {{{ Generated sources # {{{ Generated sources
FILE(GLOB LAYOUTGEN_DEPS ${SOURCE_DIR}/layouts/*.h) file(GLOB LAYOUTGEN_DEPS ${SOURCE_DIR}/layouts/*.h)
ADD_CUSTOM_COMMAND( add_custom_command(
COMMAND ${SOURCE_DIR}/build-utils/layoutgen.sh COMMAND ${SOURCE_DIR}/build-utils/layoutgen.sh
ARGS > ${BUILD_DIR}/layoutgen.h ARGS > ${BUILD_DIR}/layoutgen.h
OUTPUT ${BUILD_DIR}/layoutgen.h OUTPUT ${BUILD_DIR}/layoutgen.h
@ -111,7 +113,7 @@ ADD_CUSTOM_COMMAND(
COMMENT "Generating layoutgen.h." COMMENT "Generating layoutgen.h."
VERBATIM) VERBATIM)
ADD_CUSTOM_COMMAND( add_custom_command(
COMMAND ${SOURCE_DIR}/build-utils/widgetgen.sh COMMAND ${SOURCE_DIR}/build-utils/widgetgen.sh
ARGS > ${BUILD_DIR}/widgetgen.h ARGS > ${BUILD_DIR}/widgetgen.h
OUTPUT ${BUILD_DIR}/widgetgen.h OUTPUT ${BUILD_DIR}/widgetgen.h
@ -121,9 +123,9 @@ ADD_CUSTOM_COMMAND(
VERBATIM) VERBATIM)
# gperf # gperf
FILE(MAKE_DIRECTORY ${BUILD_DIR}/common) file(MAKE_DIRECTORY ${BUILD_DIR}/common)
ADD_CUSTOM_COMMAND( add_custom_command(
COMMAND ${SOURCE_DIR}/build-utils/gperf.sh COMMAND ${SOURCE_DIR}/build-utils/gperf.sh
ARGS ${SOURCE_DIR}/common/tokenize.gperf ARGS ${SOURCE_DIR}/common/tokenize.gperf
${BUILD_DIR}/common/tokenize.h ${BUILD_DIR}/common/tokenize.h
@ -132,7 +134,7 @@ ADD_CUSTOM_COMMAND(
${SOURCE_DIR}/build-utils/gperf.sh ${SOURCE_DIR}/build-utils/gperf.sh
COMMENT "Generating common/tokenize.h") COMMENT "Generating common/tokenize.h")
ADD_CUSTOM_COMMAND( add_custom_command(
COMMAND ${SOURCE_DIR}/build-utils/gperf.sh COMMAND ${SOURCE_DIR}/build-utils/gperf.sh
ARGS ${SOURCE_DIR}/common/tokenize.gperf ARGS ${SOURCE_DIR}/common/tokenize.gperf
${BUILD_DIR}/common/tokenize.c ${BUILD_DIR}/common/tokenize.c
@ -141,65 +143,65 @@ ADD_CUSTOM_COMMAND(
${SOURCE_DIR}/build-utils/gperf.sh ${SOURCE_DIR}/build-utils/gperf.sh
COMMENT "Generating common/tokenize.c") COMMENT "Generating common/tokenize.c")
ADD_CUSTOM_TARGET(generated_sources add_custom_target(generated_sources
DEPENDS ${BUILD_DIR}/widgetgen.h DEPENDS ${BUILD_DIR}/widgetgen.h
${BUILD_DIR}/layoutgen.h ${BUILD_DIR}/layoutgen.h
${BUILD_DIR}/common/tokenize.c ${BUILD_DIR}/common/tokenize.c
${BUILD_DIR}/common/tokenize.h) ${BUILD_DIR}/common/tokenize.h)
ADD_DEPENDENCIES(${PROJECT_AWE_NAME} generated_sources) add_dependencies(${PROJECT_AWE_NAME} generated_sources)
# }}} # }}}
# {{{ version stamp # {{{ version stamp
IF(BUILD_FROM_GIT) if(BUILD_FROM_GIT)
ADD_CUSTOM_TARGET(version_stamp ALL add_custom_target(version_stamp ALL
COMMAND ${SOURCE_DIR}/build-utils/git-version-stamp.sh COMMAND ${SOURCE_DIR}/build-utils/git-version-stamp.sh
${VERSION_STAMP_FILE} ${VERSION_STAMP_FILE}
${BUILD_DIR}/awesome-version-internal.h ${BUILD_DIR}/awesome-version-internal.h
WORKING_DIRECTORY ${SOURCE_DIR}) WORKING_DIRECTORY ${SOURCE_DIR})
ADD_DEPENDENCIES(${PROJECT_AWE_NAME} version_stamp) add_dependencies(${PROJECT_AWE_NAME} version_stamp)
ADD_DEPENDENCIES(${PROJECT_AWECLIENT_NAME} version_stamp) add_dependencies(${PROJECT_AWECLIENT_NAME} version_stamp)
ENDIF() endif()
# }}} # }}}
# {{{ Manpages. # {{{ Manpages.
IF(GENERATE_MANPAGES) if(GENERATE_MANPAGES)
# {{{ Lua API documentation. # {{{ Lua API documentation.
SET(LUADOC_FILE ${BUILD_DIR}/apidocgen.txt) set(LUADOC_FILE ${BUILD_DIR}/apidocgen.txt)
MACRO(a_file_match infile regex result_var) macro(a_file_match infile regex result_var)
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6) if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6)
# cmake < 2.6 doesn't know FILE(STRINGS ...) # cmake < 2.6 doesn't know FILE(STRINGS ...)
EXECUTE_PROCESS(COMMAND ${GREP_EXECUTABLE} -l ${regex} ${infile} execute_process(COMMAND ${GREP_EXECUTABLE} -l ${regex} ${infile}
RESULT_VARIABLE exit_code RESULT_VARIABLE exit_code
OUTPUT_QUIET) OUTPUT_QUIET)
IF(exit_code EQUAL 0) if(exit_code EQUAL 0)
SET(${result_var} TRUE) set(${result_var} TRUE)
ELSE() else()
SET(${result_var} FALSE) set(${result_var} FALSE)
ENDIF() endif()
ELSE() else()
FILE(STRINGS ${infile} match REGEX ${regex} LIMIT_COUNT 1) file(STRINGS ${infile} match REGEX ${regex} LIMIT_COUNT 1)
IF(match) if(match)
SET(${result_var} TRUE) set(${result_var} TRUE)
ELSE() else()
SET(${result_var} FALSE) set(${result_var} FALSE)
ENDIF() endif()
ENDIF() endif()
ENDMACRO() endmacro()
# find .c files exporting lua functions # find .c files exporting lua functions
FOREACH(cfile ${AWE_SRCS}) foreach(cfile ${AWE_SRCS})
a_file_match(${cfile} "const struct luaL_reg" result) a_file_match(${cfile} "const struct luaL_reg" result)
IF(result) if(result)
SET(LUA_APIDOC_SRCS ${LUA_APIDOC_SRCS} ${cfile}) set(LUA_APIDOC_SRCS ${LUA_APIDOC_SRCS} ${cfile})
ENDIF() endif()
ENDFOREACH() endforeach()
# luadoc target # luadoc target
ADD_CUSTOM_COMMAND(COMMAND ${CAT_EXECUTABLE} ${LUA_APIDOC_SRCS} add_custom_command(COMMAND ${CAT_EXECUTABLE} ${LUA_APIDOC_SRCS}
| ${LUA_EXECUTABLE} ${SOURCE_DIR}/build-utils/gendoc.lua | ${LUA_EXECUTABLE} ${SOURCE_DIR}/build-utils/gendoc.lua
> ${LUADOC_FILE} > ${LUADOC_FILE}
OUTPUT ${LUADOC_FILE} OUTPUT ${LUADOC_FILE}
@ -208,63 +210,63 @@ IF(GENERATE_MANPAGES)
COMMENT "Generating Lua API documentation." COMMENT "Generating Lua API documentation."
VERBATIM) VERBATIM)
ADD_CUSTOM_TARGET(luadoc DEPENDS ${LUADOC_FILE}) add_custom_target(luadoc DEPENDS ${LUADOC_FILE})
# }}} # }}}
FOREACH(txtfile ${AWE_MAN_SRCS}) foreach(txtfile ${AWE_MAN_SRCS})
STRING(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile}) string(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile})
STRING(REPLACE ${SOURCE_DIR} string(REPLACE ${SOURCE_DIR}
${BUILD_DIR} xmlfile ${xmlfile}) ${BUILD_DIR} xmlfile ${xmlfile})
STRING(REGEX REPLACE ".xml\$" ".gz" gzfile ${xmlfile}) string(REGEX REPLACE ".xml\$" ".gz" gzfile ${xmlfile})
STRING(REGEX REPLACE ".gz\$" "" manfile ${gzfile}) string(REGEX REPLACE ".gz\$" "" manfile ${gzfile})
# TODO: This is still not 100% right. Actually only # TODO: This is still not 100% right. Actually only
# awesomerc.5.xml should depend on ${LUADOC_FILE}. # awesomerc.5.xml should depend on ${LUADOC_FILE}.
ADD_CUSTOM_COMMAND(COMMAND ${CAT_EXECUTABLE} ${txtfile} add_custom_command(COMMAND ${CAT_EXECUTABLE} ${txtfile}
| ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} - | ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} -
WORKING_DIRECTORY ${BUILD_DIR} WORKING_DIRECTORY ${BUILD_DIR}
OUTPUT ${xmlfile} OUTPUT ${xmlfile}
DEPENDS ${txtfile} ${LUADOC_FILE} DEPENDS ${txtfile} ${LUADOC_FILE}
VERBATIM) VERBATIM)
ADD_CUSTOM_COMMAND(COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile} add_custom_command(COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile}
OUTPUT ${manfile} OUTPUT ${manfile}
DEPENDS ${xmlfile}) DEPENDS ${xmlfile})
ADD_CUSTOM_COMMAND(COMMAND ${CAT_EXECUTABLE} ${manfile} add_custom_command(COMMAND ${CAT_EXECUTABLE} ${manfile}
| ${GZIP_EXECUTABLE} | ${GZIP_EXECUTABLE}
> ${gzfile} > ${gzfile}
OUTPUT ${gzfile} OUTPUT ${gzfile}
DEPENDS ${manfile} DEPENDS ${manfile}
VERBATIM) VERBATIM)
SET(MAN_FILES ${MAN_FILES} ${gzfile}) set(MAN_FILES ${MAN_FILES} ${gzfile})
# figure out in what section to install to from filename # figure out in what section to install to from filename
STRING(REGEX REPLACE "^.*\\.([0-9])\\.gz\$" "\\1" section ${gzfile}) string(REGEX REPLACE "^.*\\.([0-9])\\.gz\$" "\\1" section ${gzfile})
SET(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${gzfile}) set(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${gzfile})
ENDFOREACH() endforeach()
ADD_CUSTOM_TARGET(man ALL DEPENDS ${MAN_FILES}) add_custom_target(man ALL DEPENDS ${MAN_FILES})
ENDIF() endif()
# }}} # }}}
# {{{ Doxygen # {{{ Doxygen
IF(DOXYGEN_EXECUTABLE) if(DOXYGEN_EXECUTABLE)
ADD_CUSTOM_TARGET(doc add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} awesome.doxygen COMMAND ${DOXYGEN_EXECUTABLE} awesome.doxygen
WORKING_DIRECTORY ${BUILD_DIR}) WORKING_DIRECTORY ${BUILD_DIR})
ENDIF() endif()
# }}} # }}}
# {{{ Installation. # {{{ Installation.
INSTALL(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin) install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin)
INSTALL(FILES ${AWE_LUA_FILES} DESTINATION ${AWESOME_REL_LUA_LIB_PATH}) install(FILES ${AWE_LUA_FILES} DESTINATION ${AWESOME_REL_LUA_LIB_PATH})
INSTALL(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_REL_CONF_PATH}) install(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_REL_CONF_PATH})
IF(GENERATE_MANPAGES) if(GENERATE_MANPAGES)
INSTALL(FILES ${AWE_MAN1_FILES} DESTINATION ${AWESOME_MAN1_PATH}) install(FILES ${AWE_MAN1_FILES} DESTINATION ${AWESOME_MAN1_PATH})
INSTALL(FILES ${AWE_MAN5_FILES} DESTINATION ${AWESOME_MAN5_PATH}) install(FILES ${AWE_MAN5_FILES} DESTINATION ${AWESOME_MAN5_PATH})
ENDIF() endif()
INSTALL(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_REL_ICON_PATH}) install(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_REL_ICON_PATH})
INSTALL(FILES ${AWE_DOC_FILES} DESTINATION ${AWESOME_REL_DOC_PATH}) install(FILES ${AWE_DOC_FILES} DESTINATION ${AWESOME_REL_DOC_PATH})
# }}} # }}}
# vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 # vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -1,23 +1,23 @@
SET(PROJECT_AWE_NAME awesome) set(PROJECT_AWE_NAME awesome)
SET(PROJECT_AWECLIENT_NAME awesome-client) set(PROJECT_AWECLIENT_NAME awesome-client)
SET(VERSION 3) set(VERSION 3)
SET(VERSION_MAJOR ${VERSION}) set(VERSION_MAJOR ${VERSION})
SET(VERSION_MINOR 0) set(VERSION_MINOR 0)
SET(VERSION_PATCH 0) set(VERSION_PATCH 0)
SET(CODENAME "Productivity Breaker") set(CODENAME "Productivity Breaker")
PROJECT(${PROJECT_AWE_NAME}) project(${PROJECT_AWE_NAME})
SET(CMAKE_BUILD_TYPE RELEASE) set(CMAKE_BUILD_TYPE RELEASE)
OPTION(WITH_DBUS "build with D-BUS" ON) option(WITH_DBUS "build with D-BUS" ON)
OPTION(WITH_IMLIB2 "build with Imlib2" ON) option(WITH_IMLIB2 "build with Imlib2" ON)
OPTION(GENERATE_MANPAGES "generate manpages" ON) option(GENERATE_MANPAGES "generate manpages" ON)
# {{{ CFLAGS # {{{ CFLAGS
ADD_DEFINITIONS(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra add_definitions(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra
-Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings
-Wsign-compare -Wunused -Wno-unused-parameter -Wuninitialized -Winit-self -Wsign-compare -Wunused -Wno-unused-parameter -Wuninitialized -Winit-self
-Wpointer-arith -Wredundant-decls -Wformat-nonliteral -Wpointer-arith -Wredundant-decls -Wformat-nonliteral
@ -25,56 +25,56 @@ ADD_DEFINITIONS(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra
# }}} # }}}
# {{{ Find external utilities # {{{ Find external utilities
FIND_PROGRAM(CAT_EXECUTABLE cat) find_program(CAT_EXECUTABLE cat)
FIND_PROGRAM(GREP_EXECUTABLE grep) find_program(GREP_EXECUTABLE grep)
FIND_PROGRAM(GIT_EXECUTABLE git) find_program(GIT_EXECUTABLE git)
FIND_PROGRAM(LUA_EXECUTABLE lua) find_program(LUA_EXECUTABLE lua)
FIND_PROGRAM(GPERF_EXECUTABLE gperf) find_program(GPERF_EXECUTABLE gperf)
# programs needed for man pages # programs needed for man pages
FIND_PROGRAM(ASCIIDOC_EXECUTABLE asciidoc) find_program(ASCIIDOC_EXECUTABLE asciidoc)
FIND_PROGRAM(XMLTO_EXECUTABLE xmlto) find_program(XMLTO_EXECUTABLE xmlto)
FIND_PROGRAM(GZIP_EXECUTABLE gzip) find_program(GZIP_EXECUTABLE gzip)
# doxygen # doxygen
INCLUDE(FindDoxygen) include(FindDoxygen)
# pkg-config # pkg-config
INCLUDE(FindPkgConfig) include(FindPkgConfig)
# }}} # }}}
# {{{ Check if manpages can be build # {{{ Check if manpages can be build
IF(GENERATE_MANPAGES) if(GENERATE_MANPAGES)
IF(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR NOT GZIP_EXECUTABLE) if(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR NOT GZIP_EXECUTABLE)
IF(NOT ASCIIDOC_EXECUTABLE) if(NOT ASCIIDOC_EXECUTABLE)
SET(missing "asciidoc") SET(missing "asciidoc")
ENDIF() endif()
IF(NOT XMLTO_EXECUTABLE) if(NOT XMLTO_EXECUTABLE)
SET(missing ${missing} " xmlto") SET(missing ${missing} " xmlto")
ENDIF() endif()
IF(NOT GZIP_EXECUTABLE) if(NOT GZIP_EXECUTABLE)
SET(missing ${missing} " gzip") SET(missing ${missing} " gzip")
ENDIF() endif()
MESSAGE(STATUS "Not generating manpages. Missing: " ${missing}) message(STATUS "Not generating manpages. Missing: " ${missing})
SET(GENERATE_MANPAGES OFF) set(GENERATE_MANPAGES OFF)
ENDIF() endif()
ENDIF() endif()
# }}} # }}}
# {{{ git version stamp # {{{ git version stamp
# If this is a git repository... # If this is a git repository...
IF(EXISTS ${SOURCE_DIR}/.git/HEAD) if(EXISTS ${SOURCE_DIR}/.git/HEAD)
IF(GIT_EXECUTABLE) if(GIT_EXECUTABLE)
# get current version # get current version
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe execute_process(COMMAND ${GIT_EXECUTABLE} describe
WORKING_DIRECTORY ${SOURCE_DIR} WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE VERSION OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
# file the git-version-stamp.sh script will look into # file the git-version-stamp.sh script will look into
SET(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp) set(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp)
FILE(WRITE ${VERSION_STAMP_FILE} ${VERSION}) file(WRITE ${VERSION_STAMP_FILE} ${VERSION})
# create a version_stamp target later # create a version_stamp target later
SET(BUILD_FROM_GIT TRUE) set(BUILD_FROM_GIT TRUE)
ENDIF() endif()
ENDIF() endif()
# }}} # }}}
# {{{ Required libraries # {{{ Required libraries
@ -102,12 +102,12 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
xcb-icccm xcb-icccm
cairo-xcb) cairo-xcb)
MACRO(a_find_library variable library) macro(a_find_library variable library)
FIND_LIBRARY(${variable} ${library}) find_library(${variable} ${library})
IF(NOT ${variable}) if(NOT ${variable})
MESSAGE(FATAL_ERROR ${library} " library not found.") message(FATAL_ERROR ${library} " library not found.")
ENDIF() endif()
ENDMACRO() endmacro()
# Check for readline, ncurse and libev # Check for readline, ncurse and libev
a_find_library(LIB_READLINE readline) a_find_library(LIB_READLINE readline)
@ -115,28 +115,28 @@ a_find_library(LIB_NCURSES ncurses)
a_find_library(LIB_EV ev) a_find_library(LIB_EV ev)
# Check for lua5.1 # Check for lua5.1
FIND_PATH(LUA_INC_DIR lua.h find_path(LUA_INC_DIR lua.h
/usr/include /usr/include
/usr/include/lua5.1 /usr/include/lua5.1
/usr/local/include/lua5.1) /usr/local/include/lua5.1)
FIND_LIBRARY(LUA_LIB NAMES lua5.1 lua find_library(LUA_LIB NAMES lua5.1 lua
/usr/lib /usr/lib
/usr/lib/lua /usr/lib/lua
/usr/local/lib) /usr/local/lib)
# Error check # Error check
IF(NOT LUA_LIB) if(NOT LUA_LIB)
MESSAGE(FATAL_ERROR "lua library not found") message(FATAL_ERROR "lua library not found")
ENDIF() endif()
SET(AWESOME_REQUIRED_LIBRARIES ${AWESOME_REQUIRED_LIBRARIES} set(AWESOME_REQUIRED_LIBRARIES ${AWESOME_REQUIRED_LIBRARIES}
${LIB_READLINE} ${LIB_READLINE}
${LIB_NCURSES} ${LIB_NCURSES}
${LIB_EV} ${LIB_EV}
${LUA_LIB}) ${LUA_LIB})
SET(AWESOME_REQUIRED_INCLUDE_DIRS ${AWESOME_REQUIRED_INCLUDE_DIRS} ${LUA_INC_DIR}) set(AWESOME_REQUIRED_INCLUDE_DIRS ${AWESOME_REQUIRED_INCLUDE_DIRS} ${LUA_INC_DIR})
# }}} # }}}
# {{{ Optional libraries. # {{{ Optional libraries.
@ -145,93 +145,93 @@ SET(AWESOME_REQUIRED_INCLUDE_DIRS ${AWESOME_REQUIRED_INCLUDE_DIRS} ${LUA_INC_DIR
# AWESOME_OPTIONAL_LIBRARIES # AWESOME_OPTIONAL_LIBRARIES
# AWESOME_OPTIONAL_INCLUDE_DIRS # AWESOME_OPTIONAL_INCLUDE_DIRS
IF(WITH_DBUS) if(WITH_DBUS)
pkg_check_modules(DBUS dbus-1) pkg_check_modules(DBUS dbus-1)
IF(DBUS_FOUND) if(DBUS_FOUND)
SET(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${DBUS_LIBRARIES}) set(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${DBUS_LIBRARIES})
SET(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${DBUS_INCLUDE_DIRS}) set(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${DBUS_INCLUDE_DIRS})
ELSE() else()
SET(WITH_DBUS OFF) set(WITH_DBUS OFF)
MESSAGE(STATUS "DBUS not found. Disabled.") message(STATUS "DBUS not found. Disabled.")
ENDIF() endif()
ENDIF() endif()
IF(WITH_IMLIB2) if(WITH_IMLIB2)
pkg_check_modules(IMLIB2 imlib2) pkg_check_modules(IMLIB2 imlib2)
IF(IMLIB2_FOUND) if(IMLIB2_FOUND)
SET(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${IMLIB2_LIBRARIES}) set(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${IMLIB2_LIBRARIES})
SET(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS}) set(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS})
ELSE() else()
SET(WITH_IMLIB2 OFF) set(WITH_IMLIB2 OFF)
MESSAGE(STATUS "Imlib2 not found. Disabled.") message(STATUS "Imlib2 not found. Disabled.")
ENDIF() endif()
ENDIF() endif()
# }}} # }}}
# {{{ Install path and configuration variables. # {{{ Install path and configuration variables.
IF(DEFINED PREFIX) if(DEFINED PREFIX)
SET(CMAKE_INSTALL_PREFIX ${PREFIX}) set(CMAKE_INSTALL_PREFIX ${PREFIX})
ENDIF() endif()
SET(AWESOME_VERSION ${VERSION} ) set(AWESOME_VERSION ${VERSION} )
SET(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} ) set(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} )
SET(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} ) set(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} )
SET(AWESOME_COMPILE_BY $ENV{USER} ) set(AWESOME_COMPILE_BY $ENV{USER} )
SET(AWESOME_RELEASE ${CODENAME} ) set(AWESOME_RELEASE ${CODENAME} )
SET(AWESOME_ETC etc ) set(AWESOME_ETC etc )
SET(AWESOME_SHARE share ) set(AWESOME_SHARE share )
SET(AWESOME_LUA_LIB_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib ) set(AWESOME_LUA_LIB_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib )
SET(AWESOME_ICON_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_SHARE}/${PROJECT_AWE_NAME}/icons ) set(AWESOME_ICON_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_SHARE}/${PROJECT_AWE_NAME}/icons )
SET(AWESOME_CONF_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_ETC}/${PROJECT_AWE_NAME} ) set(AWESOME_CONF_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_ETC}/${PROJECT_AWE_NAME} )
SET(AWESOME_MAN1_PATH ${AWESOME_SHARE}/man/man1 ) set(AWESOME_MAN1_PATH ${AWESOME_SHARE}/man/man1 )
SET(AWESOME_MAN5_PATH ${AWESOME_SHARE}/man/man5 ) set(AWESOME_MAN5_PATH ${AWESOME_SHARE}/man/man5 )
SET(AWESOME_REL_LUA_LIB_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib ) set(AWESOME_REL_LUA_LIB_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib )
SET(AWESOME_REL_CONF_PATH ${AWESOME_ETC}/${PROJECT_AWE_NAME} ) set(AWESOME_REL_CONF_PATH ${AWESOME_ETC}/${PROJECT_AWE_NAME} )
SET(AWESOME_REL_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME} ) set(AWESOME_REL_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME} )
SET(AWESOME_REL_DOC_PATH ${AWESOME_SHARE}/doc/${PROJECT_AWE_NAME}) set(AWESOME_REL_DOC_PATH ${AWESOME_SHARE}/doc/${PROJECT_AWE_NAME})
# }}} # }}}
# {{{ Configure files. # {{{ Configure files.
SET (AWESOME_CONFIGURE_FILES config.h.in set (AWESOME_CONFIGURE_FILES config.h.in
awesomerc.lua.in awesomerc.lua.in
awesome-version-internal.h.in awesome-version-internal.h.in
awesome.doxygen.in) awesome.doxygen.in)
MACRO(a_configure_file file) macro(a_configure_file file)
STRING(REGEX REPLACE ".in\$" "" outfile ${file}) string(REGEX REPLACE ".in\$" "" outfile ${file})
MESSAGE(STATUS "Configuring ${outfile}") message(STATUS "Configuring ${outfile}")
CONFIGURE_FILE(${SOURCE_DIR}/${file} configure_file(${SOURCE_DIR}/${file}
${BUILD_DIR}/${outfile} ${BUILD_DIR}/${outfile}
ESCAPE_QUOTE ESCAPE_QUOTE
@ONLY) @ONLY)
ENDMACRO() endmacro()
FOREACH(file ${AWESOME_CONFIGURE_FILES}) foreach(file ${AWESOME_CONFIGURE_FILES})
a_configure_file(${file}) a_configure_file(${file})
ENDFOREACH() endforeach()
#}}} #}}}
# {{{ CPack configuration # {{{ CPack configuration
SET(CPACK_PACKAGE_NAME "${PROJECT_AWE_NAME}") set(CPACK_PACKAGE_NAME "${PROJECT_AWE_NAME}")
SET(CPACK_GENERATOR "TBZ2") set(CPACK_GENERATOR "TBZ2")
SET(CPACK_SOURCE_GENERATOR "TBZ2") set(CPACK_SOURCE_GENERATOR "TBZ2")
SET(CPACK_SOURCE_IGNORE_FILES set(CPACK_SOURCE_IGNORE_FILES
".git;.*.swp$;.*~;.*patch;.gitignore;${BUILD_DIR}") ".git;.*.swp$;.*~;.*patch;.gitignore;${BUILD_DIR}")
FOREACH(file ${AWESOME_CONFIGURE_FILES}) foreach(file ${AWESOME_CONFIGURE_FILES})
STRING(REPLACE ".in" "" confheader ${file}) string(REPLACE ".in" "" confheader ${file})
SET( CPACK_SOURCE_IGNORE_FILES set( CPACK_SOURCE_IGNORE_FILES
";${CPACK_SOURCE_IGNORE_FILES};${confheader}$;" ) ";${CPACK_SOURCE_IGNORE_FILES};${confheader}$;" )
ENDFOREACH() endforeach()
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A dynamic floating and tiling window manager") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A dynamic floating and tiling window manager")
SET(CPACK_PACKAGE_VENDOR "awesome development team") set(CPACK_PACKAGE_VENDOR "awesome development team")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${SOURCE_DIR}/README") set(CPACK_PACKAGE_DESCRIPTION_FILE "${SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
INCLUDE(CPack) include(CPack)
#}}} #}}}
# vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 # vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80