cmake: macroify FIND_LIBRARY/check

This commit is contained in:
Michael Gehring 2008-06-20 20:29:47 +02:00 committed by Julien Danjou
parent ad073bc64c
commit dd3e37624b
1 changed files with 10 additions and 15 deletions

View File

@ -91,10 +91,17 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
xcb-icccm xcb-icccm
cairo-xcb) cairo-xcb)
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 # Check for readline, ncurse and libev
FIND_LIBRARY(LIB_READLINE readline) a_find_library(LIB_READLINE readline)
FIND_LIBRARY(LIB_NCURSES ncurses) a_find_library(LIB_NCURSES ncurses)
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
@ -108,18 +115,6 @@ FIND_LIBRARY(LUA_LIB NAMES lua5.1 lua
/usr/local/lib) /usr/local/lib)
# Error check # Error check
IF(NOT LIB_EV)
MESSAGE( FATAL_ERROR "ev library not found")
ENDIF()
IF(NOT LIB_READLINE)
MESSAGE(FATAL_ERROR "readline library not found")
ENDIF()
IF(NOT LIB_NCURSES)
MESSAGE(FATAL_ERROR "ncurse library not found")
ENDIF()
IF(NOT LUA_LIB) IF(NOT LUA_LIB)
MESSAGE(FATAL_ERROR "lua library not found") MESSAGE(FATAL_ERROR "lua library not found")
ENDIF() ENDIF()