Skip to content

Commit

Permalink
Add CARES_BUILD_TOOLS CMake option (#214)
Browse files Browse the repository at this point in the history
Add ability to exclude building of tools (adig, ahost, acountry) in CMake.  This should also close #200.

Fix By: Ruslan Baratov (@ruslo)
Bug: #200
  • Loading branch information
ruslo authored and Brad House committed Aug 8, 2018
1 parent e8e7151 commit 0418735
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions CMakeLists.txt
Expand Up @@ -33,6 +33,7 @@ OPTION (CARES_SHARED "Build as a shared library"
OPTION (CARES_INSTALL "Create installation targets (chain builders may want to disable this)" ON)
OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)" OFF)
OPTION (CARES_BUILD_TESTS "Build and run tests" OFF)
OPTION (CARES_BUILD_TOOLS "Build tools" ON)

# allow linking against the static runtime library in msvc
IF (MSVC)
Expand Down Expand Up @@ -668,29 +669,30 @@ ENDIF ()
SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND")
SET (CARES_LIBRARIES ${PROJECT_NAME}::cares CACHE INTERNAL "CARES LIBRARIES")


# Build ahost
ADD_EXECUTABLE (ahost ahost.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (ahost PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (ahost PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS ahost ${TARGETS_INST_DEST})
ENDIF ()
IF (CARES_BUILD_TOOLS)
# Build ahost
ADD_EXECUTABLE (ahost ahost.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (ahost PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (ahost PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS ahost ${TARGETS_INST_DEST})
ENDIF ()


# Build adig
ADD_EXECUTABLE (adig adig.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (adig PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (adig PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS adig ${TARGETS_INST_DEST})
ENDIF ()
# Build adig
ADD_EXECUTABLE (adig adig.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (adig PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (adig PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS adig ${TARGETS_INST_DEST})
ENDIF ()


# Build acountry
ADD_EXECUTABLE (acountry acountry.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (acountry PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (acountry PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS acountry ${TARGETS_INST_DEST})
# Build acountry
ADD_EXECUTABLE (acountry acountry.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (acountry PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (acountry PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS acountry ${TARGETS_INST_DEST})
ENDIF ()
ENDIF ()

0 comments on commit 0418735

Please sign in to comment.