Fix Mac OS X iconv library linking failure
Add a path to awesomeConfig.cmake for searching an iconv library and the corresponding header file automatically if the build system is on Mac OS X which needs to pass the header and library paths explicitly to the compiler to build Awesome successfully. Closes https://github.com/awesomeWM/awesome/pull/440.
This commit is contained in:
parent
19ae63cf13
commit
5e4318c15d
|
@ -155,6 +155,43 @@ if(NOT AWESOME_REQUIRED_FOUND OR NOT AWESOME_COMMON_REQUIRED_FOUND)
|
||||||
message(FATAL_ERROR)
|
message(FATAL_ERROR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# On Mac OS X, the executable of Awesome has to be linked against libiconv
|
||||||
|
# explicitly. Unfortunately, libiconv doesn't have its pkg-config file,
|
||||||
|
# and CMake doesn't provide a module for looking up the library. Thus, we
|
||||||
|
# have to do everything for ourselves...
|
||||||
|
if(APPLE)
|
||||||
|
if(NOT DEFINED AWESOME_ICONV_SEARCH_PATHS)
|
||||||
|
set(AWESOME_ICONV_SEARCH_PATHS /opt/local /opt /usr/local /usr)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED AWESOME_ICONV_INCLUDE_DIR)
|
||||||
|
find_path(AWESOME_ICONV_INCLUDE_DIR
|
||||||
|
iconv.h
|
||||||
|
PATHS ${AWESOME_ICONV_SEARCH_PATHS}
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
NO_CMAKE_SYSTEM_PATH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED AWESOME_ICONV_LIBRARY_PATH)
|
||||||
|
get_filename_component(AWESOME_ICONV_BASE_DIRECTORY ${AWESOME_ICONV_INCLUDE_DIR} DIRECTORY)
|
||||||
|
find_library(AWESOME_ICONV_LIBRARY_PATH
|
||||||
|
NAMES iconv
|
||||||
|
HINTS ${AWESOME_ICONV_BASE_DIRECTORY}
|
||||||
|
PATH_SUFFIXES lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED AWESOME_ICONV_LIBRARY_PATH)
|
||||||
|
message(FATAL_ERROR "Looking for iconv library - not found.")
|
||||||
|
else()
|
||||||
|
message(STATUS "Looking for iconv library - found: ${AWESOME_ICONV_LIBRARY_PATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(AWESOME_REQUIRED_LDFLAGS
|
||||||
|
${AWESOME_REQUIRED_LDFLAGS} ${AWESOME_ICONV_LIBRARY_PATH})
|
||||||
|
set(AWESOME_REQUIRED_INCLUDE_DIRS
|
||||||
|
${AWESOME_REQUIRED_INCLUDE_DIRS} ${AWESOME_ICONV_INCLUDE_DIR})
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
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})
|
||||||
|
|
Loading…
Reference in New Issue