diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-22 22:03:00 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-22 22:03:00 (GMT) |
commit | a1ad371e696289b022484c87c9d191180b132d18 (patch) | |
tree | 45c230bcd32675468d62b7bba5cd49cf4e7cdeb8 /contrib/cmake | |
parent | 4206a3f8629da7005a6154912ccd690a38541930 (diff) | |
download | uscxml-a1ad371e696289b022484c87c9d191180b132d18.zip uscxml-a1ad371e696289b022484c87c9d191180b132d18.tar.gz uscxml-a1ad371e696289b022484c87c9d191180b132d18.tar.bz2 |
Ported IM Invoker for pre 3.0 and beautified code
Diffstat (limited to 'contrib/cmake')
-rw-r--r-- | contrib/cmake/FindLibPurple.cmake | 121 |
1 files changed, 78 insertions, 43 deletions
diff --git a/contrib/cmake/FindLibPurple.cmake b/contrib/cmake/FindLibPurple.cmake index 327f6a4..1de16f5 100644 --- a/contrib/cmake/FindLibPurple.cmake +++ b/contrib/cmake/FindLibPurple.cmake @@ -1,4 +1,38 @@ include(CheckCXXSourceCompiles) +set(LIBPURPLE_LIBRARY_DIRS "") +if (NOT WIN32) + include(FindPkgConfig) + pkg_check_modules(LIBPURPLE purple) +endif () + +if (LIBPURPLE_FOUND) + FIND_LIBRARY(LIBPURPLE_LIBRARY + NAMES libpurple purple + PATHS ${LIBPURPLE_LIBRARY_DIRS} + ) + +else() + FIND_LIBRARY(LIBPURPLE_LIBRARY_RELEASE + NAMES purple libpurple libpurple-static + ) + if (LIBPURPLE_LIBRARY_RELEASE) + list(APPEND LIBPURPLE_LIBRARY optimized ${LIBPURPLE_LIBRARY_RELEASE}) + endif() + + FIND_LIBRARY(LIBPURPLE_LIBRARY_DEBUG + NAMES purple_d libpurple_d libpurple-static_d + ) + if (LIBPURPLE_LIBRARY_DEBUG) + list(APPEND LIBPURPLE_LIBRARY debug ${LIBPURPLE_LIBRARY_DEBUG}) + else() + if (UNIX) + list(APPEND LIBPURPLE_LIBRARY debug ${LIBPURPLE_LIBRARY_RELEASE}) + endif() + endif() +endif() + +# message("LIBPURPLE_LIBRARY: ${LIBPURPLE_LIBRARY}") +# message("LIBPURPLE_INCLUDE_DIR: ${LIBPURPLE_INCLUDE_DIR}") FIND_PATH(LIBPURPLE_INCLUDE_DIR purple.h PATH_SUFFIXES include/libpurple src/libpurple @@ -9,55 +43,56 @@ FIND_PATH(LIBPURPLE_INCLUDE_DIR purple.h /opt/local # DarwinPorts /opt/csw # Blastwave /opt + ${LIBPURPLE_INCLUDE_DIRS} ) -FIND_LIBRARY(LIBPURPLE_LIBRARY_RELEASE - NAMES purple libpurple libpurple-static -) -if (LIBPURPLE_LIBRARY_RELEASE) - list(APPEND LIBPURPLE_LIBRARY optimized ${LIBPURPLE_LIBRARY_RELEASE}) -endif() +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBPURPLE DEFAULT_MSG LIBPURPLE_LIBRARY LIBPURPLE_INCLUDE_DIR) -FIND_LIBRARY(LIBPURPLE_LIBRARY_DEBUG - NAMES purple_d libpurple_d libpurple-static_d -) -if (LIBPURPLE_LIBRARY_DEBUG) - list(APPEND LIBPURPLE_LIBRARY debug ${LIBPURPLE_LIBRARY_DEBUG}) -else() - if (UNIX) - list(APPEND LIBPURPLE_LIBRARY debug ${LIBPURPLE_LIBRARY_RELEASE}) - endif() -endif() +if (LIBPURPLE_FOUND) + set(LIBPURPLE_VERSION_HPP_CONTENTS "") + + file(STRINGS "${LIBPURPLE_INCLUDE_DIR}/version.h" LIBPURPLE_VERSION_HPP_CONTENTS REGEX "#define PURPLE_(.*)_VERSION (.)") -# message("LIBPURPLE_LIBRARY: ${LIBPURPLE_LIBRARY}") -# message("LIBPURPLE_INCLUDE_DIR: ${LIBPURPLE_INCLUDE_DIR}") + STRING(REGEX MATCH "PURPLE_MAJOR_VERSION \\\(([0-9]*)\\\)" _LIBPURPLE_VERSION_MAJOR ${LIBPURPLE_VERSION_HPP_CONTENTS}) + STRING(REGEX MATCH "[0-9]+" LIBPURPLE_VERSION_MAJOR ${_LIBPURPLE_VERSION_MAJOR}) + unset(_LIBPURPLE_VERSION_MAJOR) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBPURPLE DEFAULT_MSG LIBPURPLE_LIBRARY LIBPURPLE_INCLUDE_DIR) + STRING(REGEX MATCH "PURPLE_MINOR_VERSION \\\(([0-9]*)\\\)" _LIBPURPLE_VERSION_MINOR ${LIBPURPLE_VERSION_HPP_CONTENTS}) + STRING(REGEX MATCH "[0-9]+" LIBPURPLE_VERSION_MINOR ${_LIBPURPLE_VERSION_MINOR}) + unset(_LIBPURPLE_VERSION_MINOR) -# we need to check the API of libpurple, but need a couple more libraries -find_package(ICONV) -find_package(GLIB2) -find_package(GObject) -if (LIBPURPLE_FOUND AND GLIB2_FOUND AND ICONV_FOUND AND GOBJECT_FOUND) - set(CMAKE_REQUIRED_INCLUDES ${LIBPURPLE_INCLUDE_DIR} ${GLIB2_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${GOBJECT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_LIBRARIES ${LIBPURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${ICONV_LIBRARIES} ${GOBJECT_LIBRARIES}) - if (LIBPURPLE_FOUND) - check_cxx_source_compiles(" - extern \"C\" { - #include <purple.h> - } - int main(){ - /* - * There was a refactoring to glib datastructures, - * The PurpleRequestFeature occured at the same time. - */ - PurpleRequestFeature _features; - } - " LIBPURPLE_GLIB_DATASTRUCTS) - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_LIBRARIES) + STRING(REGEX MATCH "PURPLE_MICRO_VERSION \\\(([0-9]*)\\\)" _LIBPURPLE_VERSION_PATCH ${LIBPURPLE_VERSION_HPP_CONTENTS}) + STRING(REGEX MATCH "[0-9]+" LIBPURPLE_VERSION_PATCH ${_LIBPURPLE_VERSION_PATCH}) + unset(_LIBPURPLE_VERSION_PATCH) + + set(LIBPURPLE_VERSION "${LIBPURPLE_VERSION_MAJOR}.${LIBPURPLE_VERSION_MINOR}.${LIBPURPLE_VERSION_PATCH}") + unset(LIBPURPLE_VERSION_HPP_CONTENTS) endif() +# we need to check the API of libpurple, but need a couple more libraries - solved via version > 3 +# find_package(ICONV) +# find_package(GLIB2) +# find_package(GObject) +# if (LIBPURPLE_FOUND AND GLIB2_FOUND AND ICONV_FOUND AND GOBJECT_FOUND) +# set(CMAKE_REQUIRED_INCLUDES ${LIBPURPLE_INCLUDE_DIR} ${GLIB2_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${GOBJECT_INCLUDE_DIR}) +# set(CMAKE_REQUIRED_LIBRARIES ${LIBPURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${ICONV_LIBRARIES} ${GOBJECT_LIBRARIES}) +# if (LIBPURPLE_FOUND) +# check_cxx_source_compiles(" +# extern \"C\" { +# #include <purple.h> +# } +# int main(){ +# /* +# * There was a refactoring to glib datastructures, +# * The PurpleRequestFeature occured at the same time. +# */ +# PurpleRequestFeature _features; +# } +# " LIBPURPLE_GLIB_DATASTRUCTS) +# endif() +# set(CMAKE_REQUIRED_INCLUDES) +# set(CMAKE_REQUIRED_LIBRARIES) +# endif() + MARK_AS_ADVANCED(LIBPURPLE_LIBRARY LIBPURPLE_INCLUDE_DIR) |