-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10426c8
commit 7da8a9d
Showing
7 changed files
with
1,251 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,29 @@ | ||
cmake_minimum_required(VERSION 3.0.0) | ||
|
||
project(dns C) | ||
|
||
set(PROJECT_VERSION 1.0.0) | ||
set(PROJECT_VERSION_MAJOR 1) | ||
set(PROJECT_VERSION_MINOR 0) | ||
set(PROJECT_VERSION_PATCH 0) | ||
|
||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH}) | ||
|
||
find_package(PkgConfig REQUIRED) | ||
|
||
find_package(CARES REQUIRED) | ||
|
||
if (NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
|
||
########################################## | ||
|
||
add_executable(dns src/dns.c) | ||
target_link_libraries(dns CARES::libcares) | ||
|
||
########################################## | ||
|
||
include(GNUInstallDirs) | ||
|
||
install(TARGETS dns RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
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,43 @@ | ||
if (CARES_INCLUDE_DIRS AND CARES_LIBRARIES) | ||
set(CARES_FOUND TRUE) | ||
else() | ||
pkg_check_modules(PKG_CONFIG_CARES QUIET libcares) | ||
|
||
message("PKG_CONFIG_CARES_FOUND=${PKG_CONFIG_CARES_FOUND}") | ||
message("PKG_CONFIG_CARES_INCLUDE_DIRS=${PKG_CONFIG_CARES_INCLUDE_DIRS}") | ||
message("PKG_CONFIG_CARES_LIBRARY_DIRS=${PKG_CONFIG_CARES_LIBRARY_DIRS}") | ||
message("PKG_CONFIG_CARES_INCLUDEDIR=${PKG_CONFIG_CARES_INCLUDEDIR}") | ||
message("PKG_CONFIG_CARES_LIBDIR=${PKG_CONFIG_CARES_LIBDIR}") | ||
message("PKG_CONFIG_CARES_VERSION=${PKG_CONFIG_CARES_VERSION}") | ||
message("PKG_CONFIG_CARES_LIBRARIES=${PKG_CONFIG_CARES_LIBRARIES}") | ||
message("PKG_CONFIG_CARES_LINK_LIBRARIES=${PKG_CONFIG_CARES_LINK_LIBRARIES}") | ||
|
||
if (PKG_CONFIG_CARES_FOUND) | ||
if (PKG_CONFIG_CARES_INCLUDE_DIRS) | ||
set(CARES_INCLUDE_DIRS "${PKG_CONFIG_CARES_INCLUDE_DIRS}") | ||
elseif (PKG_CONFIG_CARES_INCLUDEDIR) | ||
set(CARES_INCLUDE_DIRS "${PKG_CONFIG_CARES_INCLUDEDIR}") | ||
else() | ||
find_path(CARES_INCLUDE_DIRS cares.h) | ||
endif() | ||
|
||
set(CARES_LIBRARIES ${PKG_CONFIG_CARES_LINK_LIBRARIES}) | ||
|
||
if (NOT TARGET CARES::libcares) | ||
add_library(CARES::libcares INTERFACE IMPORTED) | ||
set_target_properties(CARES::libcares PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${CARES_INCLUDE_DIRS}" | ||
INTERFACE_LINK_LIBRARIES "${CARES_LIBRARIES}" | ||
) | ||
endif() | ||
|
||
if (PKG_CONFIG_CARES_VERSION) | ||
set(CARES_VERSION_STRING ${PKG_CONFIG_CARES_VERSION}) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(CARES REQUIRED_VARS CARES_LIBRARIES CARES_INCLUDE_DIRS VERSION_VAR CARES_VERSION) | ||
|
||
mark_as_advanced(CARES_INCLUDE_DIRS CARES_LIBRARIES) |
Oops, something went wrong.