From: Hans Dedecker Date: Thu, 16 Mar 2017 20:17:24 +0000 (+0100) Subject: CMakeLists: don't enable libubox md5 implementation by default X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7e0d8b8e9f18135adc444a30a58c3c75dd722a33;p=project%2Fodhcp6c.git CMakeLists: don't enable libubox md5 implementation by default Simplify odhcp6c standalone compilation by selecting local md5 implementation by default Signed-off-by: Hans Dedecker --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 745fba2..a5b0cb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_policy(SET CMP0015 NEW) project(odhcp6c C) set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=c99") -set(LIBUBOX 1 CACHE BOOL "Link with libubox") add_definitions(-D_GNU_SOURCE -Wall -Werror -Wextra -pedantic) if(${EXT_PREFIX_CLASS}) @@ -17,15 +16,20 @@ if(${EXT_CER_ID}) endif(${EXT_CER_ID}) set(SOURCES src/odhcp6c.c src/dhcpv6.c src/ra.c src/script.c) -if(LIBUBOX EQUAL 0) - set(SOURCES ${SOURCES} src/md5.c) -endif() -add_executable(odhcp6c ${SOURCES}) set(LIBRARIES resolv) -if(LIBUBOX EQUAL 1) + +if(USE_LIBUBOX) + add_definitions(-DUSE_LIBUBOX) set(LIBRARIES ${LIBRARIES} ubox) + FIND_PATH(ubox_include_dir libubox/md5.h) + INCLUDE_DIRECTORIES(${ubox_include_dir}) +else() + set(SOURCES ${SOURCES} src/md5.c) endif() + +add_executable(odhcp6c ${SOURCES}) + target_link_libraries(odhcp6c ${LIBRARIES}) # Installation diff --git a/README b/README index 7038984..e79fea1 100644 --- a/README +++ b/README @@ -39,7 +39,7 @@ especially routers. It compiles to only about 35 KB (-Os -s). ** Compiling ** odhcp6c uses cmake: -* To prepare a Makefile use: "cmake -DLIBUBOX=0 ." +* To prepare a Makefile use: "cmake ." * To build / install use: "make" / "make install" afterwards. * To build DEB or RPM packages use: "make package" afterwards. diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 30bfa50..b732257 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -36,7 +36,7 @@ #include #include "odhcp6c.h" -#ifdef LIBUBOX +#ifdef USE_LIBUBOX #include #else #include "md5.h"