Skip to content

Commit

Permalink
Add Findlibmicrohttpd.cmake, fix #178
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazin committed May 18, 2017
1 parent 4286a50 commit 867e9dd
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -44,11 +44,13 @@ find_package(Sqlite3 REQUIRED)
find_package(APR REQUIRED)
find_package(Threads REQUIRED)
find_package(JeMalloc REQUIRED)
find_package(libmicrohttpd REQUIRED)

include_directories(${Boost_INCLUDE_DIRS})
include_directories("${APR_INCLUDE_DIR}")
include_directories("${APRUTIL_INCLUDE_DIR}")
include_directories("${SQLITE3_INCLUDE_DIR}")
include_directories("${LIBMICROHTTPD_INCLUDE_DIRS}")

#if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-std=c++1y -fvisibility=hidden)
Expand Down
2 changes: 1 addition & 1 deletion akumulid/CMakeLists.txt
Expand Up @@ -20,7 +20,7 @@ target_link_libraries(akumulid
"${APR_LIBRARY}"
"${APRUTIL_LIBRARY}"
${Boost_LIBRARIES}
microhttpd
${LIBMICROHTTPD_LIBRARY}
)

include(CppcheckTargets)
Expand Down
90 changes: 90 additions & 0 deletions cmake/Findlibmicrohttpd.cmake
@@ -0,0 +1,90 @@
# - Try to find libmicrohttpd
# Once done this will define
#
# MICROHTTPD_FOUND - system has libmicrohttpd
# MICROHTTPD_INCLUDE_DIRS - the libmicrohttpd include directory
# MICROHTTPD_LIBRARIES - Link these to use libmicrohttpd
# MICROHTTPD_DEFINITIONS - Compiler switches required for using libmicrohttpd
#
# Copyright (c) 2011 Wesley Moore <wes@wezm.net>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if (LIBMICROHTTPD_LIBRARIES AND LIBMICROHTTPD_INCLUDE_DIRS)
# in cache already
set(LIBMICROHTTPD_FOUND TRUE)
else (LIBMICROHTTPD_LIBRARIES AND LIBMICROHTTPD_INCLUDE_DIRS)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
include(UsePkgConfig)
pkgconfig(libmicrohttpd _LIBMICROHTTPD_INCLUDEDIR _LIBMICROHTTPD_LIBDIR _LIBMICROHTTPD_LDFLAGS _LIBMICROHTTPD_CFLAGS)
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_LIBMICROHTTPD libmicrohttpd)
endif (PKG_CONFIG_FOUND)
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_path(LIBMICROHTTPD_INCLUDE_DIR
NAMES
microhttpd.h
PATHS
${_LIBMICROHTTPD_INCLUDEDIR}
/usr/include
/usr/local/include
/usr/pkg/include
/opt/local/include
/sw/include
)

find_library(LIBMICROHTTPD_LIBRARY
NAMES
microhttpd
PATHS
${_LIBMICROHTTPD_LIBDIR}
/usr/lib
/usr/local/lib
/usr/pkg/lib
/opt/local/lib
/sw/lib
)

if (LIBMICROHTTPD_LIBRARY)
set(LIBMICROHTTPD_FOUND TRUE)
endif (LIBMICROHTTPD_LIBRARY)

set(LIBMICROHTTPD_INCLUDE_DIRS
${LIBMICROHTTPD_INCLUDE_DIR}
)

if (LIBMICROHTTPD_FOUND)
set(LIBMICROHTTPD_LIBRARIES
${LIBMICROHTTPD_LIBRARIES}
${LIBMICROHTTPD_LIBRARY}
)
endif (LIBMICROHTTPD_FOUND)

if (LIBMICROHTTPD_INCLUDE_DIRS AND LIBMICROHTTPD_LIBRARIES)
set(LIBMICROHTTPD_FOUND TRUE)
endif (LIBMICROHTTPD_INCLUDE_DIRS AND LIBMICROHTTPD_LIBRARIES)

if (LIBMICROHTTPD_FOUND)
if (NOT LIBMICROHTTPD_FIND_QUIETLY)
message(STATUS "Found libmicrohttpd: ${LIBMICROHTTPD_LIBRARIES}")
endif (NOT LIBMICROHTTPD_FIND_QUIETLY)
else (LIBMICROHTTPD_FOUND)
if (LIBMICROHTTPD_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libmicrohttpd")
endif (LIBMICROHTTPD_FIND_REQUIRED)
endif (LIBMICROHTTPD_FOUND)

# show the LIBMICROHTTPD_INCLUDE_DIRS and LIBMICROHTTPD_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBMICROHTTPD_INCLUDE_DIRS LIBMICROHTTPD_LIBRARIES)

endif (LIBMICROHTTPD_LIBRARIES AND LIBMICROHTTPD_INCLUDE_DIRS)


1 change: 0 additions & 1 deletion functests/CMakeLists.txt
Expand Up @@ -4,7 +4,6 @@ include_directories(../libakumuli)

target_link_libraries(storage_test
akumuli
sqlite3
"${SQLITE3_LIBRARY}"
"${APRUTIL_LIBRARY}"
"${APR_LIBRARY}"
Expand Down
2 changes: 1 addition & 1 deletion libakumuli/CMakeLists.txt
Expand Up @@ -85,7 +85,7 @@ link_directories(${Boost_LIBRARY_DIRS})

if(!APPLE)
target_link_libraries(akumuli2
sqlite3
"${SQLITE3_LIBRARY}"
"${LOG4CXX_LIBRARIES}"
"${APR_LIBRARY}"
"${APRUTIL_LIBRARY}"
Expand Down
14 changes: 7 additions & 7 deletions perftests/CMakeLists.txt
Expand Up @@ -31,8 +31,8 @@ add_executable(
../akumulid/logger.cpp
)
target_link_libraries(perf_pipeline
jemalloc
akumuli
"${JEMALLOC_LIBRARY}"
"${LOG4CXX_LIBRARIES}"
"${APR_LIBRARY}"
"${APRUTIL_LIBRARY}"
Expand All @@ -53,8 +53,8 @@ add_executable(
../akumulid/logger.cpp
)
target_link_libraries(perf_tcp_server
jemalloc
akumuli
"${JEMALLOC_LIBRARY}"
"${LOG4CXX_LIBRARIES}"
"${APR_LIBRARY}"
"${APRUTIL_LIBRARY}"
Expand Down Expand Up @@ -101,7 +101,7 @@ add_executable(

target_link_libraries(
perf_datetime_parsing
jemalloc
"${JEMALLOC_LIBRARY}"
${Boost_LIBRARIES}
)
set_target_properties(perf_datetime_parsing PROPERTIES EXCLUDE_FROM_ALL 1)
Expand Down Expand Up @@ -158,8 +158,8 @@ set_target_properties(perf_compression_throughput PROPERTIES EXCLUDE_FROM_ALL 1)
add_executable(perf_ingestion perf_ingestion.cpp)

target_link_libraries(perf_ingestion
jemalloc
akumuli
"${JEMALLOC_LIBRARY}"
"${SQLITE3_LIBRARY}"
"${APRUTIL_LIBRARY}"
"${APR_LIBRARY}"
Expand Down Expand Up @@ -190,7 +190,7 @@ add_executable(

target_link_libraries(
perf_invertedindex
jemalloc
"${JEMALLOC_LIBRARY}"
${Boost_LIBRARIES}
)
set_target_properties(perf_invertedindex PROPERTIES EXCLUDE_FROM_ALL 1)
Expand All @@ -210,7 +210,7 @@ add_executable(

target_link_libraries(
perf_blockstore
jemalloc
"${JEMALLOC_LIBRARY}"
"${APRUTIL_LIBRARY}"
"${APR_LIBRARY}"
${Boost_LIBRARIES}
Expand All @@ -234,7 +234,7 @@ add_executable(

target_link_libraries(
perf_nbtree
jemalloc
"${JEMALLOC_LIBRARY}"
"${APRUTIL_LIBRARY}"
"${APR_LIBRARY}"
${Boost_LIBRARIES}
Expand Down
8 changes: 4 additions & 4 deletions unittests/CMakeLists.txt
Expand Up @@ -69,9 +69,9 @@ add_executable(
../akumulid/logger.cpp
)
target_link_libraries(test_tcp_server
jemalloc
akumuli
sqlite3
"${JEMALLOC_LIBRARY}"
"${SQLITE3_LIBRARY}"
"${LOG4CXX_LIBRARIES}"
"${APR_LIBRARY}"
"${APRUTIL_LIBRARY}"
Expand All @@ -92,8 +92,8 @@ add_executable(
target_link_libraries(
test_querycursor
akumuli
jemalloc
sqlite3
"${JEMALLOC_LIBRARY}"
"${SQLITE3_LIBRARY}"
"${LOG4CXX_LIBRARIES}"
"${APR_LIBRARY}"
"${APRUTIL_LIBRARY}"
Expand Down

0 comments on commit 867e9dd

Please sign in to comment.