From bf28ab37beff1f99b69c838d0eb25c0945a9fe2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Fri, 30 Jan 2015 13:54:25 +0000 Subject: [PATCH] Added CMake find modules, fixing build on FreeBSD. --- CMakeLists.txt | 11 +++++++++-- cmake/FindTox.cmake | 8 ++++++++ cmake/FindWeeChat.cmake | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 cmake/FindTox.cmake create mode 100644 cmake/FindWeeChat.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cde50bc..db14efb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,10 @@ cmake_minimum_required(VERSION 2.8.7) project(tox-weechat C) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) +find_package(WeeChat) +find_package(Tox) + set(PLUGIN_PATH "lib/weechat/plugins" CACHE PATH "Path to install the plugin binary to.") @@ -44,8 +48,11 @@ add_library(tox MODULE set(CMAKE_C_FLAGS_DEBUG "-DTWC_DEBUG") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Wno-unused-parameter") -target_link_libraries(tox toxcore) -target_link_libraries(tox toxav) +include_directories(${TOX_INCLUDE_DIR}) +include_directories(${WEECHAT_INCLUDE_DIR}) + +target_link_libraries(tox ${TOX_LIBRARY}) +target_link_libraries(tox ${TOXAV_LIBRARY}) # remove lib prefix (libtox.so -> tox.so) set_target_properties(tox PROPERTIES PREFIX "") diff --git a/cmake/FindTox.cmake b/cmake/FindTox.cmake new file mode 100644 index 0000000..aead5b5 --- /dev/null +++ b/cmake/FindTox.cmake @@ -0,0 +1,8 @@ +find_path(TOX_INCLUDE_DIR tox/tox.h) +find_path(TOXAV_INCLUDE_DIR tox/toxav.h) + +find_library(TOX_LIBRARY toxcore) +find_library(TOXAV_LIBRARY toxav) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Tox DEFAULT_MSG TOX_INCLUDE_DIR TOXAV_INCLUDE_DIR TOX_LIBRARY TOXAV_LIBRARY) diff --git a/cmake/FindWeeChat.cmake b/cmake/FindWeeChat.cmake new file mode 100644 index 0000000..a4a644c --- /dev/null +++ b/cmake/FindWeeChat.cmake @@ -0,0 +1,4 @@ +find_path(WEECHAT_INCLUDE_DIR weechat/weechat-plugin.h) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WeeChat DEFAULT_MSG WEECHAT_INCLUDE_DIR)