diff --git a/CMakeLists.txt b/CMakeLists.txt index 6579a2f..7b32ac3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ -project (ndhc) - -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required(VERSION 3.3) +if(${CMAKE_VERSION} VERSION_LESS 3.12) + cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) +else() + cmake_policy(VERSION 3.12) +endif() #################################### @@ -77,8 +80,8 @@ ENDMACRO(COMPARE_VERSION_STRINGS) #################################### -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fno-strict-overflow -pedantic -Wall -Wextra -Wimplicit-fallthrough=0 -Wformat=2 -Wformat-nonliteral -Wformat-security -Wshadow -Wpointer-arith -Wmissing-prototypes -Wunused-const-variable=0 -Wsign-conversion -D_GNU_SOURCE -DNK_USE_CAPABILITY") -set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fno-strict-overflow -pedantic -Wall -Wextra -Wimplicit-fallthrough=0 -Wformat-security -Wshadow -Wpointer-arith -Wmissing-prototypes -Wunused-const-variable=0 -Wsign-conversion -D_GNU_SOURCE -DNK_USE_CAPABILITY") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fno-strict-overflow -pedantic -Wall -Wextra -Wimplicit-fallthrough=0 -Wformat=2 -Wformat-nonliteral -Wformat-security -Wshadow -Wpointer-arith -Wmissing-prototypes -Wunused-const-variable=0 -Wcast-qual -Wsign-conversion -D_GNU_SOURCE -DNK_USE_CAPABILITY -Wno-discarded-qualifiers") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -fno-strict-overflow -fno-rtti -pedantic -Wall -Wextra -Wimplicit-fallthrough=0 -Wformat-security -Wshadow -Wpointer-arith -Wmissing-prototypes -Wunused-const-variable=0 -Wcast-qual -Wsign-conversion -D_GNU_SOURCE -DNK_USE_CAPABILITY") if (WIN32) set(OSNAME "Win32") @@ -134,7 +137,5 @@ else() set(MACHINENAME $ENV{CROSSCOMPILE_MACHINENAME}) endif() -include_directories("${PROJECT_SOURCE_DIR}/ncmlib") add_subdirectory(ncmlib) - add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5d23868..c489b01 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,8 +1,4 @@ -project (ndhc) - -cmake_minimum_required (VERSION 2.6) - -include_directories("${PROJECT_SOURCE_DIR}") +project (ndhc DESCRIPTION "dhcp4 client" LANGUAGES C) set(RAGEL_IFCHD_PARSE ${CMAKE_CURRENT_BINARY_DIR}/ifchd-parse.c) set(RAGEL_CFG_PARSE ${CMAKE_CURRENT_BINARY_DIR}/cfg.c) @@ -25,7 +21,26 @@ add_custom_command( VERBATIM ) -file(GLOB NDHC_SRCS "*.c") - -add_executable(ndhc ${RAGEL_CFG_PARSE} ${RAGEL_IFCHD_PARSE} ${NDHC_SRCS}) -target_link_libraries(ndhc ncmlib) +add_executable(ndhc ${RAGEL_CFG_PARSE} ${RAGEL_IFCHD_PARSE}) +target_sources(ndhc PRIVATE + "arp.c" + "ifchd.c" + "netlink.c" + "sockd.c" + "dhcp.c" + "ifset.c" + "nl.c" + "state.c" + "duiaid.c" + "leasefile.c" + "options.c" + "sys.c" + "ifchange.c" + "ndhc.c" + "rfkill.c" +) +target_include_directories(ndhc PRIVATE + "${PROJECT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/../ncmlib" + ) +target_link_libraries(ndhc PUBLIC ncmlib)