This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add find module: CppNetlib [skip ci]
- Loading branch information
Showing
2 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Copyright (c) 2013, Ruslan Baratov | ||
# All rights reserved. | ||
|
||
# Try to find CppNetlib library | ||
# | ||
# Input variables: | ||
# CPPNETLIB_ROOT - CppNetlib installation root | ||
# | ||
# Output variables: | ||
# CPPNETLIB_INCLUDE_DIR - include directories | ||
# CPPNETLIB_LIBRARIES - libraries (client-connections, server-parsers, uri) | ||
# CPPNETLIB_FOUND - is 'YES' if library found | ||
|
||
# Libraries variants: | ||
# CPPNETLIB_URI_LIBRARY | ||
# CPPNETLIB_URI_LIBRARY_DEBUG | ||
# CPPNETLIB_URI_LIBRARY_RELEASE | ||
# CPPNETLIB_CLIENT_CONNECTIONS_LIBRARY | ||
# CPPNETLIB_CLIENT_CONNECTIONS_LIBRARY_DEBUG | ||
# CPPNETLIB_CLIENT_CONNECTIONS_LIBRARY_RELEASE | ||
# CPPNETLIB_SERVER_PARSERS_LIBRARY | ||
# CPPNETLIB_SERVER_PARSERS_LIBRARY_DEBUG | ||
# CPPNETLIB_SERVER_PARSERS_LIBRARY_RELEASE | ||
|
||
set(CPPNETLIB_FOUND YES) | ||
|
||
find_path( | ||
CPPNETLIB_INCLUDE_DIR | ||
NAMES | ||
"boost/network.hpp" | ||
HINTS | ||
"${CPPNETLIB_ROOT}" | ||
ENV | ||
"CPPNETLIB_ROOT" | ||
PATH_SUFFIXES | ||
"include" | ||
) | ||
|
||
function(_find_cppnetlib_diagnostic_message pattern) | ||
if(CPPNETLIB_ROOT) | ||
message("CPPNETLIB_ROOT(cmake): ${CPPNETLIB_ROOT}") | ||
endif() | ||
if($ENV{CPPNETLIB_ROOT}) | ||
message("CPPNETLIB_ROOT(env): $ENV{CPPNETLIB_ROOT}") | ||
endif() | ||
|
||
message( | ||
FATAL_ERROR | ||
"CppNetlib not found (pattern '${pattern}' not found)." | ||
"Please set CPPNETLIB_ROOT variable (cmake or environment)" | ||
) | ||
endfunction() | ||
|
||
if(NOT CPPNETLIB_INCLUDE_DIR) | ||
set(CPPNETLIB_FOUND NO) | ||
if(CppNetlib_FIND_REQUIRED) | ||
_find_cppnetlib_diagnostic_message("include/boost/network/hpp") | ||
endif() | ||
endif() | ||
|
||
foreach(lib uri client-connections server-parsers) | ||
string(TOUPPER "${lib}" _find_cppnetlib_upper) | ||
string(REPLACE "-" "_" _find_cppnetlib_upper "${_find_cppnetlib_upper}") | ||
set(_find_cppnetlib_upper "CPPNETLIB_${_find_cppnetlib_upper}_LIBRARY") | ||
set( | ||
_find_cppnetlib_upper_release | ||
"${_find_cppnetlib_upper}_RELEASE" | ||
) | ||
set( | ||
_find_cppnetlib_upper_debug | ||
"${_find_cppnetlib_upper}_DEBUG" | ||
) | ||
set(_find_cppnetlib_lower_release "cppnetlib-${lib}") | ||
set(_find_cppnetlib_lower_debug "cppnetlib-${lib}${CMAKE_DEBUG_POSTFIX}") | ||
|
||
find_library( | ||
${_find_cppnetlib_upper_release} | ||
${_find_cppnetlib_lower_release} | ||
HINTS | ||
"${CPPNETLIB_ROOT}" | ||
ENV | ||
"CPPNETLIB_ROOT" | ||
PATH_SUFFIXES | ||
"lib" | ||
) | ||
|
||
if(CMAKE_DEBUG_POSTFIX) | ||
find_library( | ||
${_find_cppnetlib_upper_debug} | ||
${_find_cppnetlib_lower_debug} | ||
HINTS | ||
"${CPPNETLIB_ROOT}" | ||
ENV | ||
"CPPNETLIB_ROOT" | ||
PATH_SUFFIXES | ||
"lib" | ||
) | ||
endif() | ||
|
||
if(${_find_cppnetlib_upper_debug} AND ${_find_cppnetlib_upper_release}) | ||
set( | ||
${_find_cppnetlib_upper} | ||
debug | ||
${${_find_cppnetlib_upper_debug}} | ||
release | ||
${${_find_cppnetlib_upper_release}} | ||
) | ||
elseif(${_find_cppnetlib_upper_release}) | ||
set(${_find_cppnetlib_upper} ${${_find_cppnetlib_upper_release}}) | ||
else() | ||
set(CPPNETLIB_FOUND NO) | ||
if(CppNetlib_FIND_REQUIRED) | ||
_find_cppnetlib_diagnostic_message( | ||
"lib/...${_find_cppnetlib_lower_release}..." | ||
) | ||
endif() | ||
endif() | ||
|
||
if(${_find_cppnetlib_upper}) | ||
list(APPEND CPPNETLIB_LIBRARIES ${${_find_cppnetlib_upper}}) | ||
endif() | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set(HUNTER_VERSION "0.0.12") |