Add CARES_BUILD_TOOLS CMake option (#214)

Add ability to exclude building of tools (adig, ahost, acountry) in CMake.  This should also close #200.

Fix By: Ruslan Baratov (@ruslo)
Bug: #200
pull/223/head
Ruslan Baratov 6 years ago committed by Brad House
parent e8e7151849
commit 041873579d
  1. 44
      CMakeLists.txt

@ -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)
@ -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 ()

Loading…
Cancel
Save