Use _LDFLAGS instead of _LIBRARIES

If a library is in a non-standard path, the linker needs an extra argument so
that it knows how to find this library: -L/path/to/lib

pkg_check_modules() sets _LIBRARIES only to the library's name, but _LDFLAGS
also contains a -L flag if one was found.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-08-23 11:33:47 +02:00
parent 63e4ba460b
commit c8dea3cff6
2 changed files with 10 additions and 10 deletions

View File

@ -97,9 +97,9 @@ set_target_properties(${PROJECT_AWE_NAME}
LINK_FLAGS -export-dynamic) LINK_FLAGS -export-dynamic)
target_link_libraries(${PROJECT_AWE_NAME} target_link_libraries(${PROJECT_AWE_NAME}
${AWESOME_COMMON_REQUIRED_LIBRARIES} ${AWESOME_COMMON_REQUIRED_LDFLAGS}
${AWESOME_REQUIRED_LIBRARIES} ${AWESOME_REQUIRED_LDFLAGS}
${AWESOME_OPTIONAL_LIBRARIES}) ${AWESOME_OPTIONAL_LDFLAGS})
# atoms # atoms
file(MAKE_DIRECTORY ${BUILD_DIR}/common) file(MAKE_DIRECTORY ${BUILD_DIR}/common)

View File

@ -124,7 +124,7 @@ execute_process(
# {{{ Required libraries # {{{ Required libraries
# #
# this sets up: # this sets up:
# AWESOME_REQUIRED_LIBRARIES # AWESOME_REQUIRED_LDFLAGS
# AWESOME_REQUIRED_INCLUDE_DIRS # AWESOME_REQUIRED_INCLUDE_DIRS
# Use pkgconfig to get most of the libraries # Use pkgconfig to get most of the libraries
@ -175,8 +175,8 @@ if(NOT HAS_EXECINFO)
find_library(LIB_EXECINFO execinfo) find_library(LIB_EXECINFO execinfo)
if(LIB_EXECINFO) if(LIB_EXECINFO)
set(HAS_EXECINFO 1) set(HAS_EXECINFO 1)
set(AWESOME_REQUIRED_LIBRARIES set(AWESOME_REQUIRED_LDFLAGS
${AWESOME_REQUIRED_LIBRARIES} ${AWESOME_REQUIRED_LDFLAGS}
${LIB_EXECINFO}) ${LIB_EXECINFO})
endif() endif()
endif() endif()
@ -191,9 +191,9 @@ if(NOT LUA51_FOUND AND NOT LUA50_FOUND) # This is a workaround to a cmake bug
message(FATAL_ERROR "lua library not found") message(FATAL_ERROR "lua library not found")
endif() endif()
set(AWESOME_REQUIRED_LIBRARIES set(AWESOME_REQUIRED_LDFLAGS
${AWESOME_COMMON_REQUIRED_LDFLAGS} ${AWESOME_COMMON_REQUIRED_LDFLAGS}
${AWESOME_REQUIRED_LIBRARIES} ${AWESOME_REQUIRED_LDFLAGS}
${LIB_EV} ${LIB_EV}
${LUA_LIBRARIES}) ${LUA_LIBRARIES})
@ -206,13 +206,13 @@ set(AWESOME_REQUIRED_INCLUDE_DIRS
# {{{ Optional libraries # {{{ Optional libraries
# #
# this sets up: # this sets up:
# AWESOME_OPTIONAL_LIBRARIES # AWESOME_OPTIONAL_LDFLAGS
# 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_LDFLAGS}) set(AWESOME_OPTIONAL_LDFLAGS ${AWESOME_OPTIONAL_LDFLAGS} ${DBUS_LDFLAGS})
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)