cmake: restructure required/optional libs

This commit is contained in:
Michael Gehring 2008-06-20 19:36:26 +02:00 committed by Julien Danjou
parent 30ea399f52
commit 37ccec4800
2 changed files with 49 additions and 34 deletions

View file

@ -6,7 +6,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
INCLUDE(awesomeConfig.cmake) INCLUDE(awesomeConfig.cmake)
INCLUDE_DIRECTORIES(${AWE_INC_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${AWESOME_REQUIRED_INCLUDE_DIRS}
${AWESOME_OPTIONAL_INCLUDE_DIRS})
SET(AWE_LUA_FILES SET(AWE_LUA_FILES
${CMAKE_CURRENT_SOURCE_DIR}/lib/tabulous.lua ${CMAKE_CURRENT_SOURCE_DIR}/lib/tabulous.lua
@ -85,14 +87,11 @@ ADD_EXECUTABLE(${PROJECT_AWE_NAME} ${AWE_SRCS})
ADD_EXECUTABLE(${PROJECT_AWECLIENT_NAME} ${AWE_CLIENT_SRCS}) ADD_EXECUTABLE(${PROJECT_AWECLIENT_NAME} ${AWE_CLIENT_SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_AWE_NAME} TARGET_LINK_LIBRARIES(${PROJECT_AWE_NAME}
${AWE_MOD_LIBRARIES} ${AWESOME_REQUIRED_LIBRARIES}
${LUA_LIB} ${AWESOME_OPTIONAL_LIBRARIES})
${LIB_EV}
${LIB_READLINE}
${LIB_NCURSES})
TARGET_LINK_LIBRARIES(${PROJECT_AWECLIENT_NAME} TARGET_LINK_LIBRARIES(${PROJECT_AWECLIENT_NAME}
${AWE_MOD_LIBRARIES} ${AWESOME_REQUIRED_LIBRARIES}
${LIB_READLINE} ${LIB_READLINE}
${LIB_NCURSES}) ${LIB_NCURSES})

View file

@ -64,9 +64,14 @@ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/HEAD)
ENDIF() ENDIF()
ENDIF() ENDIF()
# {{{ Required libraries
#
# this sets up:
# AWESOME_REQUIRED_LIBRARIES
# AWESOME_REQUIRED_INCLUDE_DIRS
# Use pkgconfig to get most of the libraries # Use pkgconfig to get most of the libraries
pkg_check_modules(AWE_MOD REQUIRED pkg_check_modules(AWESOME_REQUIRED REQUIRED
glib-2.0 glib-2.0
cairo cairo
pango pango
@ -89,29 +94,6 @@ FIND_LIBRARY(LIB_READLINE readline)
FIND_LIBRARY(LIB_NCURSES ncurses) FIND_LIBRARY(LIB_NCURSES ncurses)
FIND_LIBRARY(LIB_EV ev) FIND_LIBRARY(LIB_EV ev)
# Check for optional libs
IF(WITH_DBUS)
pkg_check_modules(DBUS dbus-1)
IF(DBUS_FOUND)
SET(AWE_MOD_LIBRARIES ${AWE_MOD_LIBRARIES} ${DBUS_LIBRARIES})
SET(AWE_MOD_INCLUDE_DIRS ${AWE_MOD_INCLUDE_DIRS} ${DBUS_INCLUDE_DIRS})
ELSE()
SET(WITH_DBUS OFF)
MESSAGE(STATUS "DBUS not found. Disabled.")
ENDIF()
ENDIF()
IF(WITH_IMLIB2)
pkg_check_modules(IMLIB2 imlib2)
IF(IMLIB2_FOUND)
SET(AWE_MOD_LIBRARIES ${AWE_MOD_LIBRARIES} ${IMLIB2_LIBRARIES})
SET(AWE_MOD_INCLUDE_DIRS ${AWE_MOD_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS})
ELSE()
SET(WITH_IMLIB2 OFF)
MESSAGE(STATUS "Imlib2 not found. Disabled.")
ENDIF()
ENDIF()
# 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
@ -140,6 +122,43 @@ 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}
${LIB_READLINE}
${LIB_NCURSES}
${LIB_EV}
${LUA_LIB})
SET(AWESOME_REQUIRED_INCLUDE_DIRS ${AWESOME_REQUIRED_INCLUDE_DIRS} ${LUA_INC_DIR})
# }}}
# {{{ Optional libraries.
#
# this sets up:
# AWESOME_OPTIONAL_LIBRARIES
# AWESOME_OPTIONAL_INCLUDE_DIRS
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(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()
# }}}
# Set awesome informations and path # Set awesome informations and path
IF(DEFINED PREFIX) IF(DEFINED PREFIX)
@ -189,9 +208,6 @@ EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-utils/widgetgen.sh
OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/widgetgen.h OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/widgetgen.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# Set the awesome include dir
SET(AWE_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ${AWE_MOD_INCLUDE_DIRS} ${LUA_INC_DIR})
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")