FindMHD.cmake 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # Find microhttpd
  2. #
  3. # Find the microhttpd includes and library
  4. #
  5. # if you need to add a custom library search path, do it via via CMAKE_PREFIX_PATH
  6. #
  7. # This module defines
  8. # MHD_INCLUDE_DIRS, where to find header, etc.
  9. # MHD_LIBRARIES, the libraries needed to use jsoncpp.
  10. # MHD_FOUND, If false, do not try to use jsoncpp.
  11. find_path(
  12. MHD_INCLUDE_DIR
  13. NAMES microhttpd.h
  14. DOC "microhttpd include dir"
  15. )
  16. find_library(
  17. MHD_LIBRARY
  18. NAMES microhttpd microhttpd-10 microhttpd-12 libmicrohttpd libmicrohttpd-dll
  19. DOC "microhttpd library"
  20. )
  21. # /usr/lib/x86_64-linux-gnu/libmicrohttpd.a
  22. set(MHD_INCLUDE_DIRS ${MHD_INCLUDE_DIR})
  23. set(MHD_LIBRARIES "/usr/lib/x86_64-linux-gnu/libmicrohttpd.a")
  24. #set(MHD_LIBRARIES ${MHD_LIBRARY})
  25. # debug library on windows
  26. # same naming convention as in QT (appending debug library with d)
  27. # boost is using the same "hack" as us with "optimized" and "debug"
  28. # official MHD project actually uses _d suffix
  29. include(FindPackageHandleStandardArgs)
  30. find_package_handle_standard_args(mhd DEFAULT_MSG
  31. MHD_LIBRARY MHD_INCLUDE_DIR)
  32. mark_as_advanced(MHD_INCLUDE_DIR MHD_LIBRARY)
  33. # Find microhttpd
  34. #
  35. # Find the microhttpd includes and library
  36. #
  37. # if you need to add a custom library search path, do it via via CMAKE_PREFIX_PATH
  38. #
  39. # This module defines
  40. # MHD_INCLUDE_DIRS, where to find header, etc.
  41. # MHD_LIBRARIES, the libraries needed to use jsoncpp.
  42. # MHD_FOUND, If false, do not try to use jsoncpp.
  43. #find_path(
  44. # MHD_INCLUDE_DIR
  45. # NAMES microhttpd.h
  46. # DOC "microhttpd include dir"
  47. #)
  48. #find_library(
  49. # MHD_LIBRARY
  50. # NAMES microhttpd microhttpd-10 libmicrohttpd libmicrohttpd-dll
  51. # DOC "microhttpd library"
  52. #)
  53. #set(MHD_INCLUDE_DIRS ${MHD_INCLUDE_DIR})
  54. #set(MHD_LIBRARIES ${MHD_LIBRARY})
  55. #include(FindPackageHandleStandardArgs)
  56. #find_package_handle_standard_args(mhd DEFAULT_MSG
  57. # MHD_LIBRARY MHD_INCLUDE_DIR)
  58. #mark_as_advanced(MHD_INCLUDE_DIR MHD_LIBRARY)
  59. #message(STATUS "FindMicrohttpd check")
  60. #include(FindPkgConfig)
  61. #if ( PKG_CONFIG_FOUND )
  62. # pkg_check_modules (PC_MICROHTTPD microhttpd)
  63. # set(MICROHTTPD_DEFINITIONS ${PC_MICROHTTPD_CFLAGS_OTHER})
  64. ## message(STATUS "micrhttpd checked:" ${MICROHTTPD_DEFINITIONS})
  65. #endif(PKG_CONFIG_FOUND)
  66. # this does nothing
  67. # set defaults
  68. #SET(_microhttpd_HOME "/usr/local")
  69. #SET(_microhttpd_INCLUDE_SEARCH_DIRS
  70. # ${CMAKE_INCLUDE_PATH}
  71. # /usr/local/include
  72. # /usr/include
  73. # )
  74. #SET(_microhttpd_LIBRARIES_SEARCH_DIRS
  75. # ${CMAKE_LIBRARY_PATH}
  76. # /usr/local/lib
  77. # /usr/lib
  78. # )
  79. #
  80. ###
  81. #if( "${MICROHTTPD_HOME}" STREQUAL "")
  82. # if("" MATCHES "$ENV{MICROHTTPD_HOME}")
  83. # message(STATUS "MICROHTTPD_HOME env is not set, setting it to /usr/local")
  84. # set (MICROHTTPD_HOME ${_microhttpd_HOME})
  85. # else("" MATCHES "$ENV{MICROHTTPD_HOME}")
  86. # set (MICROHTTPD_HOME "$ENV{MICROHTTPD_HOME}")
  87. # endif("" MATCHES "$ENV{MICROHTTPD_HOME}")
  88. #else( "${MICROHTTPD_HOME}" STREQUAL "")
  89. # message(STATUS "MICROHTTPD_HOME is not empty: \"${MICROHTTPD_HOME}\"")
  90. #endif( "${MICROHTTPD_HOME}" STREQUAL "")
  91. ##
  92. #message(STATUS "Looking for microhttpd in ${MICROHTTPD_HOME}")
  93. #
  94. #IF( NOT ${MICROHTTPD_HOME} STREQUAL "" )
  95. # SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS})
  96. # SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS})
  97. # SET(_microhttpd_HOME ${MICROHTTPD_HOME})
  98. #message(STATUS "setting search dirs")
  99. #ENDIF( NOT ${MICROHTTPD_HOME} STREQUAL "" )
  100. #
  101. #IF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" )
  102. ## SET(_microhttpd_INCLUDE_SEARCH_DIRS $ENV{MICROHTTPD_INCLUDEDIR} ${_microhttpd_INCLUDE_SEARCH_DIRS})
  103. #ENDIF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" )
  104. #
  105. #IF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" )
  106. ## SET(_microhttpd_LIBRARIES_SEARCH_DIRS $ENV{MICROHTTPD_LIBRARYDIR} ${_microhttpd_LIBRARIES_SEARCH_DIRS})
  107. ##ENDIF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" )
  108. #3
  109. #IF( MICROHTTPD_HOME )
  110. # SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS})
  111. # SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS})
  112. # SET(_microhttpd_HOME ${MICROHTTPD_HOME})
  113. # message(STATUS "microhttpdhome")
  114. #ENDIF( MICROHTTPD_HOME )
  115. #
  116. ## find the include files
  117. #FIND_PATH(MICROHTTPD_INCLUDE_DIR microhttpd.h
  118. # HINTS
  119. # ${_microhttpd_INCLUDE_SEARCH_DIRS}
  120. # ${PC_MICROHTTPD_INCLUDEDIR}
  121. # ${PC_MICROHTTPD_INCLUDE_DIRS}
  122. # ${CMAKE_INCLUDE_PATH}
  123. #)
  124. #
  125. #IF( NOT $ENV{MICROHTTPD_INCLUDE_DIR} STREQUAL "" )
  126. # message(STATUS, "are we here?")
  127. #ENDIF( NOT $ENV{MICROHTTPD_INCLUDE_DIR} STREQUAL "" )
  128. #
  129. # locate the library
  130. #
  131. #SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.a)
  132. #SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.so)
  133. ##FIND_LIBRARY(MICROHTTPD_LIBRARY NAMES ${MICROHTTPD_LIBRARY_NAMES}
  134. # HINTS
  135. # ${_microhttpd_LIBRARIES_SEARCH_DIRS}
  136. # ${PC_MICROHTTPD_LIBDIR}
  137. # ${PC_MICROHTTPD_LIBRARY_DIRS}
  138. #)
  139. #
  140. ## if the include and the program are found then we have it
  141. #IF(MICROHTTPD_INCLUDE_DIR AND MICROHTTPD_LIBRARY)
  142. # SET(MICROHTTPD_FOUND "YES")
  143. # message(STATUS "microhttpdhome found")
  144. #ENDIF(MICROHTTPD_INCLUDE_DIR AND MICROHTTPD_LIBRARY)
  145. #
  146. ## list(APPEND MICROHTTPD_LIBRARY " -lrt")
  147. ## ????
  148. #message(STATUS "microhttpdhome library" ${MICROHTTPD_LIBRARY})
  149. #
  150. #MARK_AS_ADVANCED(
  151. # MICROHTTPD_FOUND
  152. # MICROHTTPD_LIBRARY
  153. # MICROHTTPD_INCLUDE_DIR
  154. #)
  155. #
  156. ##add_library(jsonrpc::mhd STATIC IMPORTED)
  157. ##set_property(TARGET jsonrpc::mhd PROPERTY IMPORTED_LOCATION ${MICROHTTPD_LIBRARY})
  158. #
  159. #link_libraries(${MICROHTTPD_LIBRARIES})