AC_DEFINE(_BSD_SOURCE, 1, [Define as necessary to "unhide" header symbols.]) AC_DEFINE(__BSD_SOURCE, 1, [Define as necessary to "unhide" header symbols.]) AC_DEFINE(__FAVOR_BSD, 1, [Define if we should favor the BSD APIs when possible in Linux.]) LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD" AC_CHECK_HEADERS(net/ethernet.h, \ LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H") AC_ARG_ENABLE([samples], [AS_HELP_STRING([--enable-samples],[install the sample programs @<:@default=no@:>@])]) AM_CONDITIONAL([INSTALL_SAMPLES], [test x"$enable_samples" = xyes]) AC_OUTPUT(Makefile src/Makefile win32/Makefile \ include/Makefile \ include/libnet/Makefile include/win32/Makefile \ sample/Makefile \ version.h include/libnet.h libnet-config)转为cmake适用的语法
时间: 2024-03-21 11:39:05 浏览: 122
Define_Grid_Motion.zip_DEFINE_GRID_MOTION_fluent udf_fluent变形_f
5星 · 资源好评率100%
在CMake中,您可以使用以下代码替换上述Autoconf和Automake代码:
```
# Define necessary symbols
add_compile_definitions(_BSD_SOURCE __BSD_SOURCE __FAVOR_BSD)
# Check for header file and define LIBNET_CONFIG_DEFINES
find_header(net/ethernet.h)
if(NOT ${net/ethernet.h}_FOUND)
message(FATAL_ERROR "net/ethernet.h not found")
endif()
set(LIBNET_CONFIG_DEFINES "${LIBNET_CONFIG_DEFINES} -DHAVE_NET_ETHERNET_H")
# Enable installation of sample programs
option(enable_samples "install the sample programs" OFF)
# Generate output files
configure_file(version.h.in version.h)
configure_file(libnet-config.in libnet-config @ONLY)
configure_file(include/libnet.h.in include/libnet.h @ONLY)
add_subdirectory(src)
add_subdirectory(include)
add_subdirectory(sample)
```
注意,这只是一个简单的示例,实际上您需要根据您的项目目录结构和需要进行修改。
阅读全文