diff --git a/CMakeLists.txt b/CMakeLists.txt index 9148b5202491c79ff8b1c40d4fc0e185a552fa49..bc281891031370d26fb48cb89398b35e746f2823 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,13 @@ enable_testing() set(THREADS_PREFER_PTHREAD_FLAG ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") +find_package( glog REQUIRED ) +find_package( OpenCV REQUIRED ) +find_package( Threads REQUIRED ) +find_package( URIParser REQUIRED ) +find_package( MsgPack ) +find_package( LibSGM ) + check_language(CUDA) if (CUDA_TOOLKIT_ROOT_DIR) enable_language(CUDA) @@ -22,23 +29,21 @@ add_definitions(-DHAVE_CUDA) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) endif () -find_package( glog REQUIRED ) -find_package( OpenCV REQUIRED ) -find_package( Threads REQUIRED ) -find_package( MsgPack ) -find_package( LibSGM ) - -if (NOT MSGPACK_FOUND) +if (NOT MsgPack_FOUND) check_include_file_cxx("msgpack.hpp" MSGPACK_FOUND) if (NOT MSGPACK_FOUND) message(ERROR "Msgpack is required") endif() +else() + include_directories(${MSGPACK_INCLUDE_DIRS}) endif() +if (NOT WIN32) check_include_file("uuid/uuid.h" UUID_FOUND) if (NOT UUID_FOUND) message(ERROR "UUID library is required") endif() +endif() find_program(CPPCHECK_FOUND cppcheck) if (CPPCHECK_FOUND) diff --git a/cmake/FindURIParser.cmake b/cmake/FindURIParser.cmake new file mode 100644 index 0000000000000000000000000000000000000000..70d3366ebbfaa6b337bb25baaf94ffe2ae7f460a --- /dev/null +++ b/cmake/FindURIParser.cmake @@ -0,0 +1,36 @@ +############################################################################### +# Find URI Parser +# + +if(WIN32) +find_path(URIP_DIR NAMES include/uriparser/Uri.h PATHS "C:/Program Files/uriparser" "C:/Program Files (x86)/uriparser") +else() +set(URIP_DIR "") +endif() + +# Find lib +set(URIPARSER_FOUND FALSE CACHE BOOL "" FORCE) +find_library(URIPARSER_LIBRARY + NAMES uriparser liburiparser + PATHS ${URIP_DIR} + PATH_SUFFIXES lib/ +) + +# Find include +find_path(URIPARSER_INCLUDE_DIRS + NAMES uriparser/Uri.h + PATHS ${URIP_DIR} + PATH_SUFFIXES include +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(URIParser DEFAULT_MSG URIPARSER_LIBRARY URIPARSER_INCLUDE_DIRS) + +mark_as_advanced(URIPARSER_FOUND) + +if(URIPARSER_FOUND) + include_directories(${URIPARSER_INCLUDE_DIRS}) + set(URIPARSER_FOUND TRUE CACHE BOOL "" FORCE) + set(URIPARSER_LIBRARIES ${URIPARSER_LIBRARY}) + message(STATUS "Found URIParser") +endif() diff --git a/cmake/Findglog.cmake b/cmake/Findglog.cmake index dc0bf0bd33dab68b2fce0b7da134605a9a920923..8b5883975bf0328aec24a14fe001aa975a1222ec 100644 --- a/cmake/Findglog.cmake +++ b/cmake/Findglog.cmake @@ -3,8 +3,8 @@ # if(WIN32) -find_path(glog_DIR glog PATHS "C:/Program Files" "C:/Program Files (x86)") -set(glog_DIR ${glog_DIR}/glog) +find_path(glog_DIR NAMES include/glog/logging.h PATHS "C:/Program Files/glog" "C:/Program Files/google-glog" "C:/Program Files (x86)/google-glog") +set(glog_DIR ${glog_DIR}) else() set(glog_DIR "") endif() diff --git a/net/cpp/CMakeLists.txt b/net/cpp/CMakeLists.txt index 7a35df67158e4371b3a2c1dfc8b6c67175bd1eb7..2eadfb088235b43aae0d8bbd2dfcbf87c32fb35b 100644 --- a/net/cpp/CMakeLists.txt +++ b/net/cpp/CMakeLists.txt @@ -11,10 +11,10 @@ set(NETSOURCE src/protocol.cpp ) -check_include_file("uriparser/Uri.h" HAVE_URI_H) -if(NOT HAVE_URI_H) - message(FATAL_ERROR "Uriparser not found") -endif() +#check_include_file("uriparser/Uri.h" HAVE_URI_H) +#if(NOT HAVE_URI_H) +# message(FATAL_ERROR "Uriparser not found") +#endif() check_function_exists(uriParseSingleUriA HAVE_URIPARSESINGLE) add_library(net ${NETSOURCE})