CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(dnsmasq C) SET(SRCS src/arp.c src/auth.c src/blockdata.c src/bpf.c src/cache.c src/conntrack.c src/crypto.c src/dbus.c src/dhcp6.c src/dhcp.c src/dhcp-common.c src/dnsmasq.c src/dnssec.c src/domain.c src/dump.c src/edns0.c src/forward.c src/helper.c src/inotify.c src/ipset.c src/lease.c src/log.c src/loop.c src/metrics.c src/netlink.c src/network.c src/option.c src/outpacket.c src/poll.c src/radv.c src/rfc1035.c src/rfc2131.c src/rfc3315.c src/rrfilter.c src/slaac.c src/tables.c src/tftp.c src/ubus.c src/util.c ) SET(PACKAGE ${PROJECT_NAME}) SET(PKGNAME ${PACKAGE}) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(BINDIR "${PREFIX}/bin") IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") #INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED dbus-1) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") SET(CMAKE_C_FLAGS_RELEASE "-O2") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") #IF("${ARCH}" STREQUAL "arm") # ADD_DEFINITIONS("-D_MMICHECK_ARM_CODE_") #ENDIF("${ARCH}" STREQUAL "arm") ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})