--- quassel/CMakeLists.txt 2008-08-26 18:18:17.000000000 +0000 +++ quassel.work/CMakeLists.txt 2008-08-27 03:43:02.000000000 +0000 @@ -79,6 +79,42 @@ add_definitions(-DQT_NO_OPENSSL) endif(NOT OPENSSL_FOUND) + +# Set up execinfo + +# The problem with this library is that it is built-in in the Linux glib, +# while on systems like FreeBSD, it is installed separately and thus needs to be linked to. +# Therefore, we search for the header to see if the it's available in the first place. +# If it is available, we try to locate the library to figure out whether it is built-in or not. + +find_path(EXECINFO_H_DIR "execinfo.h") + +if(NOT EXECINFO_H_DIR STREQUAL "EXECINFO_H_DIR-NOTFOUND") + # We found the header file's include dir. + # Let's add it so the compiler finds it as well. + include_directories(${EXECINFO_H_DIR}) + + # Now determine if it's built-in or not, by searching the library file. + find_library(EXECINFO_LIB_PATH "execinfo") + + if(EXECINFO_LIB_PATH STREQUAL "EXECINFO_LIB_PATH-NOTFOUND") + # Built-in, no further action is needed + message(STATUS "Found execinfo") + else(EXECINFO_LIB_PATH STREQUAL "EXECINFO_LIB_PATH-NOTFOUND") + # It's an external library, link it. + link_libraries(${EXECINFO_LIB_PATH}) + message(STATUS "Found execinfo: ${EXECINFO_LIB_PATH}") + endif(EXECINFO_LIB_PATH STREQUAL "EXECINFO_LIB_PATH-NOTFOUND") + + set(HAVE_EXECINFO true) + +endif(NOT EXECINFO_H_DIR STREQUAL "EXECINFO_H_DIR-NOTFOUND") + +if(HAVE_EXECINFO) + add_definitions(-DHAVE_EXECINFO) +endif(HAVE_EXECINFO) + + # Select a Qt installation here, if you don't want to use system Qt if(QT) # FindQt4 will look for the qmake binary in $PATH, so we just prepend the Qt dir