diff --git a/CMakeLists.txt b/CMakeLists.txt index fd06a4b91..129646b4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,35 +1,35 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7) -SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) +cmake_minimum_required(VERSION 2.4.7) +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) -SET(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -SET(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) +set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) -IF(NOT EXISTS ${SOURCE_DIR}/awesomeConfig.cmake) - MESSAGE(FATAL_ERROR "Please provide awesomeConfig.cmake") -ENDIF() +if(NOT EXISTS ${SOURCE_DIR}/awesomeConfig.cmake) + message(FATAL_ERROR "Please provide awesomeConfig.cmake") +endif() -INCLUDE(awesomeConfig.cmake) +include(awesomeConfig.cmake) -INCLUDE_DIRECTORIES(${SOURCE_DIR} +include_directories(${SOURCE_DIR} ${BUILD_DIR} ${AWESOME_REQUIRED_INCLUDE_DIRS} ${AWESOME_OPTIONAL_INCLUDE_DIRS}) -SET(AWE_LUA_FILES +set(AWE_LUA_FILES ${SOURCE_DIR}/lib/tabulous.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}/BUGS ${SOURCE_DIR}/README ${SOURCE_DIR}/LICENSE) -SET(AWE_SRCS +set(AWE_SRCS ${SOURCE_DIR}/awesome.c ${SOURCE_DIR}/client.c ${SOURCE_DIR}/cnode.c @@ -75,34 +75,36 @@ SET(AWE_SRCS ${SOURCE_DIR}/widgets/textbox.c ${SOURCE_DIR}/widgets/systray.c) -SET(AWE_CLIENT_SRCS +set(AWE_CLIENT_SRCS ${SOURCE_DIR}/awesome-client.c ${SOURCE_DIR}/common/socket.c ${SOURCE_DIR}/common/util.c ${SOURCE_DIR}/common/version.c) -SET(AWE_MAN_SRCS +set(AWE_MAN_SRCS ${SOURCE_DIR}/awesome.1.txt ${SOURCE_DIR}/awesome-client.1.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) -ADD_EXECUTABLE(${PROJECT_AWECLIENT_NAME} ${AWE_CLIENT_SRCS} - ${CMAKE_CURRENT_BINARY_DIR}/common/tokenize.c) +add_executable(${PROJECT_AWECLIENT_NAME} + ${AWE_CLIENT_SRCS} + ${BUILD_DIR}/common/tokenize.c) -TARGET_LINK_LIBRARIES(${PROJECT_AWE_NAME} +target_link_libraries(${PROJECT_AWE_NAME} ${AWESOME_REQUIRED_LIBRARIES} ${AWESOME_OPTIONAL_LIBRARIES}) -TARGET_LINK_LIBRARIES(${PROJECT_AWECLIENT_NAME} +target_link_libraries(${PROJECT_AWECLIENT_NAME} ${LIB_READLINE} ${LIB_NCURSES}) # {{{ Generated sources -FILE(GLOB LAYOUTGEN_DEPS ${SOURCE_DIR}/layouts/*.h) -ADD_CUSTOM_COMMAND( +file(GLOB LAYOUTGEN_DEPS ${SOURCE_DIR}/layouts/*.h) +add_custom_command( COMMAND ${SOURCE_DIR}/build-utils/layoutgen.sh ARGS > ${BUILD_DIR}/layoutgen.h OUTPUT ${BUILD_DIR}/layoutgen.h @@ -111,7 +113,7 @@ ADD_CUSTOM_COMMAND( COMMENT "Generating layoutgen.h." VERBATIM) -ADD_CUSTOM_COMMAND( +add_custom_command( COMMAND ${SOURCE_DIR}/build-utils/widgetgen.sh ARGS > ${BUILD_DIR}/widgetgen.h OUTPUT ${BUILD_DIR}/widgetgen.h @@ -121,9 +123,9 @@ ADD_CUSTOM_COMMAND( VERBATIM) # 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 ARGS ${SOURCE_DIR}/common/tokenize.gperf ${BUILD_DIR}/common/tokenize.h @@ -132,7 +134,7 @@ ADD_CUSTOM_COMMAND( ${SOURCE_DIR}/build-utils/gperf.sh COMMENT "Generating common/tokenize.h") -ADD_CUSTOM_COMMAND( +add_custom_command( COMMAND ${SOURCE_DIR}/build-utils/gperf.sh ARGS ${SOURCE_DIR}/common/tokenize.gperf ${BUILD_DIR}/common/tokenize.c @@ -141,65 +143,65 @@ ADD_CUSTOM_COMMAND( ${SOURCE_DIR}/build-utils/gperf.sh COMMENT "Generating common/tokenize.c") -ADD_CUSTOM_TARGET(generated_sources +add_custom_target(generated_sources DEPENDS ${BUILD_DIR}/widgetgen.h ${BUILD_DIR}/layoutgen.h ${BUILD_DIR}/common/tokenize.c ${BUILD_DIR}/common/tokenize.h) -ADD_DEPENDENCIES(${PROJECT_AWE_NAME} generated_sources) +add_dependencies(${PROJECT_AWE_NAME} generated_sources) # }}} # {{{ version stamp -IF(BUILD_FROM_GIT) - ADD_CUSTOM_TARGET(version_stamp ALL +if(BUILD_FROM_GIT) + add_custom_target(version_stamp ALL COMMAND ${SOURCE_DIR}/build-utils/git-version-stamp.sh ${VERSION_STAMP_FILE} ${BUILD_DIR}/awesome-version-internal.h WORKING_DIRECTORY ${SOURCE_DIR}) - ADD_DEPENDENCIES(${PROJECT_AWE_NAME} version_stamp) - ADD_DEPENDENCIES(${PROJECT_AWECLIENT_NAME} version_stamp) -ENDIF() + add_dependencies(${PROJECT_AWE_NAME} version_stamp) + add_dependencies(${PROJECT_AWECLIENT_NAME} version_stamp) +endif() # }}} # {{{ Manpages. -IF(GENERATE_MANPAGES) +if(GENERATE_MANPAGES) # {{{ 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) - IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6) + macro(a_file_match infile regex result_var) + if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6) # 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 OUTPUT_QUIET) - IF(exit_code EQUAL 0) - SET(${result_var} TRUE) - ELSE() - SET(${result_var} FALSE) - ENDIF() - ELSE() - FILE(STRINGS ${infile} match REGEX ${regex} LIMIT_COUNT 1) - IF(match) - SET(${result_var} TRUE) - ELSE() - SET(${result_var} FALSE) - ENDIF() - ENDIF() - ENDMACRO() + if(exit_code EQUAL 0) + set(${result_var} TRUE) + else() + set(${result_var} FALSE) + endif() + else() + file(STRINGS ${infile} match REGEX ${regex} LIMIT_COUNT 1) + if(match) + set(${result_var} TRUE) + else() + set(${result_var} FALSE) + endif() + endif() + endmacro() # find .c files exporting lua functions - FOREACH(cfile ${AWE_SRCS}) + foreach(cfile ${AWE_SRCS}) a_file_match(${cfile} "const struct luaL_reg" result) - IF(result) - SET(LUA_APIDOC_SRCS ${LUA_APIDOC_SRCS} ${cfile}) - ENDIF() - ENDFOREACH() + if(result) + set(LUA_APIDOC_SRCS ${LUA_APIDOC_SRCS} ${cfile}) + endif() + endforeach() # 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 > ${LUADOC_FILE} OUTPUT ${LUADOC_FILE} @@ -208,63 +210,63 @@ IF(GENERATE_MANPAGES) COMMENT "Generating Lua API documentation." VERBATIM) - ADD_CUSTOM_TARGET(luadoc DEPENDS ${LUADOC_FILE}) + add_custom_target(luadoc DEPENDS ${LUADOC_FILE}) # }}} - FOREACH(txtfile ${AWE_MAN_SRCS}) - STRING(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile}) - STRING(REPLACE ${SOURCE_DIR} + foreach(txtfile ${AWE_MAN_SRCS}) + string(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile}) + string(REPLACE ${SOURCE_DIR} ${BUILD_DIR} xmlfile ${xmlfile}) - STRING(REGEX REPLACE ".xml\$" ".gz" gzfile ${xmlfile}) - STRING(REGEX REPLACE ".gz\$" "" manfile ${gzfile}) + string(REGEX REPLACE ".xml\$" ".gz" gzfile ${xmlfile}) + string(REGEX REPLACE ".gz\$" "" manfile ${gzfile}) # TODO: This is still not 100% right. Actually only # 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} - WORKING_DIRECTORY ${BUILD_DIR} OUTPUT ${xmlfile} DEPENDS ${txtfile} ${LUADOC_FILE} VERBATIM) - ADD_CUSTOM_COMMAND(COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile} + add_custom_command(COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile} OUTPUT ${manfile} DEPENDS ${xmlfile}) - ADD_CUSTOM_COMMAND(COMMAND ${CAT_EXECUTABLE} ${manfile} + add_custom_command(COMMAND ${CAT_EXECUTABLE} ${manfile} | ${GZIP_EXECUTABLE} > ${gzfile} OUTPUT ${gzfile} DEPENDS ${manfile} VERBATIM) - SET(MAN_FILES ${MAN_FILES} ${gzfile}) + set(MAN_FILES ${MAN_FILES} ${gzfile}) # figure out in what section to install to from filename - STRING(REGEX REPLACE "^.*\\.([0-9])\\.gz\$" "\\1" section ${gzfile}) - SET(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${gzfile}) - ENDFOREACH() + string(REGEX REPLACE "^.*\\.([0-9])\\.gz\$" "\\1" section ${gzfile}) + set(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${gzfile}) + endforeach() - ADD_CUSTOM_TARGET(man ALL DEPENDS ${MAN_FILES}) -ENDIF() + add_custom_target(man ALL DEPENDS ${MAN_FILES}) +endif() # }}} # {{{ Doxygen -IF(DOXYGEN_EXECUTABLE) - ADD_CUSTOM_TARGET(doc +if(DOXYGEN_EXECUTABLE) + add_custom_target(doc COMMAND ${DOXYGEN_EXECUTABLE} awesome.doxygen WORKING_DIRECTORY ${BUILD_DIR}) -ENDIF() +endif() # }}} # {{{ Installation. -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_CONF_FILES} DESTINATION ${AWESOME_REL_CONF_PATH}) -IF(GENERATE_MANPAGES) - INSTALL(FILES ${AWE_MAN1_FILES} DESTINATION ${AWESOME_MAN1_PATH}) - INSTALL(FILES ${AWE_MAN5_FILES} DESTINATION ${AWESOME_MAN5_PATH}) -ENDIF() -INSTALL(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_REL_ICON_PATH}) -INSTALL(FILES ${AWE_DOC_FILES} DESTINATION ${AWESOME_REL_DOC_PATH}) +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_CONF_FILES} DESTINATION ${AWESOME_REL_CONF_PATH}) +if(GENERATE_MANPAGES) + install(FILES ${AWE_MAN1_FILES} DESTINATION ${AWESOME_MAN1_PATH}) + install(FILES ${AWE_MAN5_FILES} DESTINATION ${AWESOME_MAN5_PATH}) +endif() +install(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_REL_ICON_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 diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 17a649ffc..5ffc84151 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -1,23 +1,23 @@ -SET(PROJECT_AWE_NAME awesome) -SET(PROJECT_AWECLIENT_NAME awesome-client) +set(PROJECT_AWE_NAME awesome) +set(PROJECT_AWECLIENT_NAME awesome-client) -SET(VERSION 3) -SET(VERSION_MAJOR ${VERSION}) -SET(VERSION_MINOR 0) -SET(VERSION_PATCH 0) +set(VERSION 3) +set(VERSION_MAJOR ${VERSION}) +set(VERSION_MINOR 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_IMLIB2 "build with Imlib2" ON) -OPTION(GENERATE_MANPAGES "generate manpages" ON) +option(WITH_DBUS "build with D-BUS" ON) +option(WITH_IMLIB2 "build with Imlib2" ON) +option(GENERATE_MANPAGES "generate manpages" ON) # {{{ 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 -Wsign-compare -Wunused -Wno-unused-parameter -Wuninitialized -Winit-self -Wpointer-arith -Wredundant-decls -Wformat-nonliteral @@ -25,56 +25,56 @@ ADD_DEFINITIONS(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra # }}} # {{{ Find external utilities -FIND_PROGRAM(CAT_EXECUTABLE cat) -FIND_PROGRAM(GREP_EXECUTABLE grep) -FIND_PROGRAM(GIT_EXECUTABLE git) -FIND_PROGRAM(LUA_EXECUTABLE lua) -FIND_PROGRAM(GPERF_EXECUTABLE gperf) +find_program(CAT_EXECUTABLE cat) +find_program(GREP_EXECUTABLE grep) +find_program(GIT_EXECUTABLE git) +find_program(LUA_EXECUTABLE lua) +find_program(GPERF_EXECUTABLE gperf) # programs needed for man pages -FIND_PROGRAM(ASCIIDOC_EXECUTABLE asciidoc) -FIND_PROGRAM(XMLTO_EXECUTABLE xmlto) -FIND_PROGRAM(GZIP_EXECUTABLE gzip) +find_program(ASCIIDOC_EXECUTABLE asciidoc) +find_program(XMLTO_EXECUTABLE xmlto) +find_program(GZIP_EXECUTABLE gzip) # doxygen -INCLUDE(FindDoxygen) +include(FindDoxygen) # pkg-config -INCLUDE(FindPkgConfig) +include(FindPkgConfig) # }}} # {{{ Check if manpages can be build -IF(GENERATE_MANPAGES) - IF(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR NOT GZIP_EXECUTABLE) - IF(NOT ASCIIDOC_EXECUTABLE) +if(GENERATE_MANPAGES) + if(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR NOT GZIP_EXECUTABLE) + if(NOT ASCIIDOC_EXECUTABLE) SET(missing "asciidoc") - ENDIF() - IF(NOT XMLTO_EXECUTABLE) + endif() + if(NOT XMLTO_EXECUTABLE) SET(missing ${missing} " xmlto") - ENDIF() - IF(NOT GZIP_EXECUTABLE) + endif() + if(NOT GZIP_EXECUTABLE) SET(missing ${missing} " gzip") - ENDIF() + endif() - MESSAGE(STATUS "Not generating manpages. Missing: " ${missing}) - SET(GENERATE_MANPAGES OFF) - ENDIF() -ENDIF() + message(STATUS "Not generating manpages. Missing: " ${missing}) + set(GENERATE_MANPAGES OFF) + endif() +endif() # }}} # {{{ git version stamp # If this is a git repository... -IF(EXISTS ${SOURCE_DIR}/.git/HEAD) - IF(GIT_EXECUTABLE) +if(EXISTS ${SOURCE_DIR}/.git/HEAD) + if(GIT_EXECUTABLE) # get current version - EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe + execute_process(COMMAND ${GIT_EXECUTABLE} describe WORKING_DIRECTORY ${SOURCE_DIR} OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) # file the git-version-stamp.sh script will look into - SET(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp) - FILE(WRITE ${VERSION_STAMP_FILE} ${VERSION}) + set(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp) + file(WRITE ${VERSION_STAMP_FILE} ${VERSION}) # create a version_stamp target later - SET(BUILD_FROM_GIT TRUE) - ENDIF() -ENDIF() + set(BUILD_FROM_GIT TRUE) + endif() +endif() # }}} # {{{ Required libraries @@ -102,12 +102,12 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED xcb-icccm cairo-xcb) -MACRO(a_find_library variable library) - FIND_LIBRARY(${variable} ${library}) - IF(NOT ${variable}) - MESSAGE(FATAL_ERROR ${library} " library not found.") - ENDIF() -ENDMACRO() +macro(a_find_library variable library) + find_library(${variable} ${library}) + if(NOT ${variable}) + message(FATAL_ERROR ${library} " library not found.") + endif() +endmacro() # Check for readline, ncurse and libev a_find_library(LIB_READLINE readline) @@ -115,28 +115,28 @@ a_find_library(LIB_NCURSES ncurses) a_find_library(LIB_EV ev) # Check for lua5.1 -FIND_PATH(LUA_INC_DIR lua.h +find_path(LUA_INC_DIR lua.h /usr/include /usr/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/lua /usr/local/lib) # Error check -IF(NOT LUA_LIB) - MESSAGE(FATAL_ERROR "lua library not found") -ENDIF() +if(NOT LUA_LIB) + message(FATAL_ERROR "lua library not found") +endif() -SET(AWESOME_REQUIRED_LIBRARIES ${AWESOME_REQUIRED_LIBRARIES} +set(AWESOME_REQUIRED_LIBRARIES ${AWESOME_REQUIRED_LIBRARIES} ${LIB_READLINE} ${LIB_NCURSES} ${LIB_EV} ${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. @@ -145,93 +145,93 @@ SET(AWESOME_REQUIRED_INCLUDE_DIRS ${AWESOME_REQUIRED_INCLUDE_DIRS} ${LUA_INC_DIR # AWESOME_OPTIONAL_LIBRARIES # AWESOME_OPTIONAL_INCLUDE_DIRS -IF(WITH_DBUS) +if(WITH_DBUS) pkg_check_modules(DBUS dbus-1) - IF(DBUS_FOUND) - SET(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${DBUS_LIBRARIES}) - SET(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${DBUS_INCLUDE_DIRS}) - ELSE() - SET(WITH_DBUS OFF) - MESSAGE(STATUS "DBUS not found. Disabled.") - ENDIF() -ENDIF() + if(DBUS_FOUND) + set(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${DBUS_LIBRARIES}) + set(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${DBUS_INCLUDE_DIRS}) + else() + set(WITH_DBUS OFF) + message(STATUS "DBUS not found. Disabled.") + endif() +endif() -IF(WITH_IMLIB2) +if(WITH_IMLIB2) pkg_check_modules(IMLIB2 imlib2) - IF(IMLIB2_FOUND) - SET(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${IMLIB2_LIBRARIES}) - SET(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS}) - ELSE() - SET(WITH_IMLIB2 OFF) - MESSAGE(STATUS "Imlib2 not found. Disabled.") - ENDIF() -ENDIF() + if(IMLIB2_FOUND) + set(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${IMLIB2_LIBRARIES}) + set(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS}) + else() + set(WITH_IMLIB2 OFF) + message(STATUS "Imlib2 not found. Disabled.") + endif() +endif() # }}} # {{{ Install path and configuration variables. -IF(DEFINED PREFIX) - SET(CMAKE_INSTALL_PREFIX ${PREFIX}) -ENDIF() -SET(AWESOME_VERSION ${VERSION} ) -SET(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} ) -SET(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} ) -SET(AWESOME_COMPILE_BY $ENV{USER} ) -SET(AWESOME_RELEASE ${CODENAME} ) -SET(AWESOME_ETC etc ) -SET(AWESOME_SHARE share ) -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_CONF_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_ETC}/${PROJECT_AWE_NAME} ) -SET(AWESOME_MAN1_PATH ${AWESOME_SHARE}/man/man1 ) -SET(AWESOME_MAN5_PATH ${AWESOME_SHARE}/man/man5 ) -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_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME} ) -SET(AWESOME_REL_DOC_PATH ${AWESOME_SHARE}/doc/${PROJECT_AWE_NAME}) +if(DEFINED PREFIX) + set(CMAKE_INSTALL_PREFIX ${PREFIX}) +endif() +set(AWESOME_VERSION ${VERSION} ) +set(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} ) +set(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} ) +set(AWESOME_COMPILE_BY $ENV{USER} ) +set(AWESOME_RELEASE ${CODENAME} ) +set(AWESOME_ETC etc ) +set(AWESOME_SHARE share ) +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_CONF_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_ETC}/${PROJECT_AWE_NAME} ) +set(AWESOME_MAN1_PATH ${AWESOME_SHARE}/man/man1 ) +set(AWESOME_MAN5_PATH ${AWESOME_SHARE}/man/man5 ) +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_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME} ) +set(AWESOME_REL_DOC_PATH ${AWESOME_SHARE}/doc/${PROJECT_AWE_NAME}) # }}} # {{{ Configure files. -SET (AWESOME_CONFIGURE_FILES config.h.in +set (AWESOME_CONFIGURE_FILES config.h.in awesomerc.lua.in awesome-version-internal.h.in awesome.doxygen.in) -MACRO(a_configure_file file) - STRING(REGEX REPLACE ".in\$" "" outfile ${file}) - MESSAGE(STATUS "Configuring ${outfile}") - CONFIGURE_FILE(${SOURCE_DIR}/${file} +macro(a_configure_file file) + string(REGEX REPLACE ".in\$" "" outfile ${file}) + message(STATUS "Configuring ${outfile}") + configure_file(${SOURCE_DIR}/${file} ${BUILD_DIR}/${outfile} ESCAPE_QUOTE @ONLY) -ENDMACRO() +endmacro() -FOREACH(file ${AWESOME_CONFIGURE_FILES}) +foreach(file ${AWESOME_CONFIGURE_FILES}) a_configure_file(${file}) -ENDFOREACH() +endforeach() #}}} # {{{ CPack configuration -SET(CPACK_PACKAGE_NAME "${PROJECT_AWE_NAME}") -SET(CPACK_GENERATOR "TBZ2") -SET(CPACK_SOURCE_GENERATOR "TBZ2") -SET(CPACK_SOURCE_IGNORE_FILES +set(CPACK_PACKAGE_NAME "${PROJECT_AWE_NAME}") +set(CPACK_GENERATOR "TBZ2") +set(CPACK_SOURCE_GENERATOR "TBZ2") +set(CPACK_SOURCE_IGNORE_FILES ".git;.*.swp$;.*~;.*patch;.gitignore;${BUILD_DIR}") -FOREACH(file ${AWESOME_CONFIGURE_FILES}) - STRING(REPLACE ".in" "" confheader ${file}) - SET( CPACK_SOURCE_IGNORE_FILES +foreach(file ${AWESOME_CONFIGURE_FILES}) + string(REPLACE ".in" "" confheader ${file}) + set( CPACK_SOURCE_IGNORE_FILES ";${CPACK_SOURCE_IGNORE_FILES};${confheader}$;" ) -ENDFOREACH() +endforeach() -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A dynamic floating and tiling window manager") -SET(CPACK_PACKAGE_VENDOR "awesome development team") -SET(CPACK_PACKAGE_DESCRIPTION_FILE "${SOURCE_DIR}/README") -SET(CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/LICENSE") -SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A dynamic floating and tiling window manager") +set(CPACK_PACKAGE_VENDOR "awesome development team") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${SOURCE_DIR}/README") +set(CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") +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