Added CMake find modules, fixing build on FreeBSD.

This commit is contained in:
Håvard Pettersson 2015-01-30 13:54:25 +00:00
parent 37e3b66691
commit bf28ab37be
3 changed files with 21 additions and 2 deletions

View File

@ -21,6 +21,10 @@ cmake_minimum_required(VERSION 2.8.7)
project(tox-weechat C) 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 set(PLUGIN_PATH "lib/weechat/plugins" CACHE PATH
"Path to install the plugin binary to.") "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_DEBUG "-DTWC_DEBUG")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Wno-unused-parameter") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Wno-unused-parameter")
target_link_libraries(tox toxcore) include_directories(${TOX_INCLUDE_DIR})
target_link_libraries(tox toxav) include_directories(${WEECHAT_INCLUDE_DIR})
target_link_libraries(tox ${TOX_LIBRARY})
target_link_libraries(tox ${TOXAV_LIBRARY})
# remove lib prefix (libtox.so -> tox.so) # remove lib prefix (libtox.so -> tox.so)
set_target_properties(tox PROPERTIES PREFIX "") set_target_properties(tox PROPERTIES PREFIX "")

8
cmake/FindTox.cmake Normal file
View File

@ -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)

4
cmake/FindWeeChat.cmake Normal file
View File

@ -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)