From 08b72c44383f9cd561b387cbe966fbcb8f69c542 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Fri, 16 May 2025 12:14:50 +0200 Subject: [PATCH] build: Remove C dependency --- CMakeLists.txt | 2 +- build-support/macros-and-definitions.cmake | 11 +++++------ ns3 | 2 -- src/fd-net-device/CMakeLists.txt | 12 ++++++------ 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a19edf40..39d5660a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.20..3.20) # ############################################################################## # Project name # # ############################################################################## -project(NS3 CXX C) +project(NS3 CXX) file(STRINGS VERSION NS3_VER) diff --git a/build-support/macros-and-definitions.cmake b/build-support/macros-and-definitions.cmake index 35eb4163a..92ccf480a 100644 --- a/build-support/macros-and-definitions.cmake +++ b/build-support/macros-and-definitions.cmake @@ -60,7 +60,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # Include CMake files used for compiler checks -include(CheckIncludeFile) # Used to check a single C header at a time include(CheckIncludeFileCXX) # Used to check a single C++ header at a time include(CheckIncludeFiles) # Used to check multiple headers at once include(CheckFunctionExists) @@ -1129,11 +1128,11 @@ macro(process_options) # Check for required headers and functions, set flags if they're found or warn # if they're not found - check_include_file("sys/types.h" "HAVE_SYS_TYPES_H") - check_include_file("sys/stat.h" "HAVE_SYS_STAT_H") - check_include_file("dirent.h" "HAVE_DIRENT_H") - check_include_file("signal.h" "HAVE_SIGNAL_H") - check_include_file("netpacket/packet.h" "HAVE_PACKETH") + check_include_file_cxx("sys/types.h" "HAVE_SYS_TYPES_H") + check_include_file_cxx("sys/stat.h" "HAVE_SYS_STAT_H") + check_include_file_cxx("dirent.h" "HAVE_DIRENT_H") + check_include_file_cxx("signal.h" "HAVE_SIGNAL_H") + check_include_file_cxx("netpacket/packet.h" "HAVE_PACKETH") check_function_exists("getenv" "HAVE_GETENV") configure_file( diff --git a/ns3 b/ns3 index 3b1994179..2020477e1 100755 --- a/ns3 +++ b/ns3 @@ -1179,8 +1179,6 @@ def extract_cmakecache_settings(current_cmake_cache_folder): current_settings.extend(re.findall("(CMAKE_GENERATOR):.*=(.*)", contents)) # extract generator current_settings.extend(re.findall("(CMAKE_CXX_COMPILER):.*=(.*)", contents)) # C++ compiler current_settings.extend(re.findall("(CMAKE_CXX_FLAGS):.*=(.*)", contents)) # C++ flags - current_settings.extend(re.findall("(CMAKE_C_COMPILER):.*=(.*)", contents)) # C compiler - current_settings.extend(re.findall("(CMAKE_C_FLAGS):.*=(.*)", contents)) # C flags current_settings.extend( re.findall("(CMAKE_INSTALL_PREFIX):.*=(.*)", contents) ) # installation directory diff --git a/src/fd-net-device/CMakeLists.txt b/src/fd-net-device/CMakeLists.txt index 3c93319de..750905851 100644 --- a/src/fd-net-device/CMakeLists.txt +++ b/src/fd-net-device/CMakeLists.txt @@ -1,26 +1,26 @@ set(module_enabled_features) # modulegen_customizations consumes this list -check_include_file( +check_include_file_cxx( net/ethernet.h HAVE_NET_ETHERNET_H ) -check_include_file( +check_include_file_cxx( netpacket/packet.h HAVE_PACKET_H ) -check_include_file( +check_include_file_cxx( net/if.h HAVE_IF_NETS_H ) -check_include_file( +check_include_file_cxx( linux/if_tun.h HAVE_IF_TUN_H ) -check_include_file( +check_include_file_cxx( net/netmap_user.h HAVE_NETMAP_USER_H ) -check_include_file( +check_include_file_cxx( sys/ioctl.h HAVE_SYS_IOCTL_H )