Support cmake (#153)

* First cmake list file, simple docs.

TODO: utils folder.

* Support for building utils

* All fields except HAVE_DOPRNT in place

* Now builds and runs :)
This commit is contained in:
Thomas Arp 2025-07-02 22:23:10 +02:00 committed by GitHub
parent b9d84fc325
commit 3e0c1ccc18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 892 additions and 17 deletions

337
src/conf.h.cmake.in Normal file
View file

@ -0,0 +1,337 @@
/* src/conf.h.cmake.in. Used as basis for conf.h when building with cmake */
#ifndef _CONF_H_
#define _CONF_H_
/* Define to empty if the keyword does not work. */
#define const @CONST_KEYWORD@
/* Define if you don't have vprintf but do have _doprnt. */
#cmakedefine HAVE_DOPRNT
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#cmakedefine HAVE_SYS_WAIT_H
/* Define if you have the vprintf function. */
#cmakedefine HAVE_VPRINTF
/* Define to `int' if <sys/types.h> doesn't define. */
#cmakedefine pid_t @pid_t@
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE @RETSIGTYPE@
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#cmakedefine size_t @size_t@
/* Define if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#cmakedefine TIME_WITH_SYS_TIME
/* Define if we're compiling CircleMUD under any type of UNIX system. */
#cmakedefine CIRCLE_UNIX
/* Define if the system is capable of using crypt() to encrypt. */
#cmakedefine CIRCLE_CRYPT
/* Define if we don't have proper support for the system's crypt(). */
#cmakedefine HAVE_UNSAFE_CRYPT
/* Define is the system has struct in_addr. */
#cmakedefine HAVE_STRUCT_IN_ADDR
/* Define to `int' if <sys/socket.h> doesn't define. */
#cmakedefine socklen_t @socklen_t@
/* Define to `int' if <sys/types.h> doesn't define. */
#cmakedefine ssize_t @ssize_t@
/* Define if you have the gettimeofday function. */
#cmakedefine HAVE_GETTIMEOFDAY
/* Define if you have the inet_addr function. */
#cmakedefine HAVE_INET_ADDR
/* Define if you have the inet_aton function. */
#cmakedefine HAVE_INET_ATON
/* Define if you have the select function. */
#cmakedefine HAVE_SELECT
/* Define if you have the snprintf function. */
#cmakedefine HAVE_SNPRINTF
/* Define if you have the strcasecmp function. */
#cmakedefine HAVE_STRCASECMP
/* Define if you have the strdup function. */
#cmakedefine HAVE_STRDUP
/* Define if you have the strerror function. */
#cmakedefine HAVE_STRERROR
/* Define if you have the stricmp function. */
#cmakedefine HAVE_STRICMP
/* Define if you have the strlcpy function. */
#cmakedefine HAVE_STRLCPY
/* Define if you have the strncasecmp function. */
#cmakedefine HAVE_STRNCASECMP
/* Define if you have the strnicmp function. */
#cmakedefine HAVE_STRNICMP
/* Define if you have the strstr function. */
#cmakedefine HAVE_STRSTR
/* Define if you have the vsnprintf function. */
#cmakedefine HAVE_VSNPRINTF
/* Define if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H
/* Define if you have the <arpa/telnet.h> header file. */
#cmakedefine HAVE_ARPA_TELNET_H
/* Define if you have the <assert.h> header file. */
#cmakedefine HAVE_ASSERT_H
/* Define if you have the <crypt.h> header file. */
#cmakedefine HAVE_CRYPT_H
/* Define if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H
/* Define if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H
/* Define if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H
/* Define if you have the <mcheck.h> header file. */
#cmakedefine HAVE_MCHECK_H
/* Define if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H
/* Define if you have the <net/errno.h> header file. */
#cmakedefine HAVE_NET_ERRNO_H
/* Define if you have the <netdb.h> header file. */
#cmakedefine HAVE_NETDB_H
/* Define if you have the <netinet/in.h> header file. */
#cmakedefine HAVE_NETINET_IN_H
/* Define if you have the <signal.h> header file. */
#cmakedefine HAVE_SIGNAL_H
/* Define if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H
/* Define if you have the <sys/fcntl.h> header file. */
#cmakedefine HAVE_SYS_FCNTL_H
/* Define if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/select.h> header file. */
#cmakedefine HAVE_SYS_SELECT_H
/* Define if you have the <sys/socket.h> header file. */
#cmakedefine HAVE_SYS_SOCKET_H
/* Define if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H
/* Define if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H
/* Define if you have the <sys/uio.h> header file. */
#cmakedefine HAVE_SYS_UIO_H
/* Define if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H
/* Define if you have the malloc library (-lmalloc). */
#cmakedefine HAVE_LIBMALLOC
/* Check for a prototype to accept. */
#cmakedefine NEED_ACCEPT_PROTO
/* Check for a prototype to atoi. */
#cmakedefine NEED_ATOI_PROTO
/* Check for a prototype to atol. */
#cmakedefine NEED_ATOL_PROTO
/* Check for a prototype to bind. */
#cmakedefine NEED_BIND_PROTO
/* Check for a prototype to bzero. */
#cmakedefine NEED_BZERO_PROTO
/* Check for a prototype to chdir. */
#cmakedefine NEED_CHDIR_PROTO
/* Check for a prototype to close. */
#cmakedefine NEED_CLOSE_PROTO
/* Check for a prototype to crypt. */
#cmakedefine NEED_CRYPT_PROTO
/* Check for a prototype to fclose. */
#cmakedefine NEED_FCLOSE_PROTO
/* Check for a prototype to fcntl. */
#cmakedefine NEED_FCNTL_PROTO
/* Check for a prototype to fflush. */
#cmakedefine NEED_FFLUSH_PROTO
/* Check for a prototype to fprintf. */
#cmakedefine NEED_FPRINTF_PROTO
/* Check for a prototype to fputc. */
#cmakedefine NEED_FPUTC_PROTO
/* Check for a prototype to fputs. */
#cmakedefine NEED_FPUTS_PROTO
/* Check for a prototype to fread. */
#cmakedefine NEED_FREAD_PROTO
/* Check for a prototype to fscanf. */
#cmakedefine NEED_FSCANF_PROTO
/* Check for a prototype to fseek. */
#cmakedefine NEED_FSEEK_PROTO
/* Check for a prototype to fwrite. */
#cmakedefine NEED_FWRITE_PROTO
/* Check for a prototype to getpeername. */
#cmakedefine NEED_GETPEERNAME_PROTO
/* Check for a prototype to getpid. */
#cmakedefine NEED_GETPID_PROTO
/* Check for a prototype to getrlimit. */
#cmakedefine NEED_GETRLIMIT_PROTO
/* Check for a prototype to getsockname. */
#cmakedefine NEED_GETSOCKNAME_PROTO
/* Check for a prototype to gettimeofday. */
#cmakedefine NEED_GETTIMEOFDAY_PROTO
/* Check for a prototype to htonl. */
#cmakedefine NEED_HTONL_PROTO
/* Check for a prototype to htons. */
#cmakedefine NEED_HTONS_PROTO
/* Check for a prototype to inet_addr. */
#cmakedefine NEED_INET_ADDR_PROTO
/* Check for a prototype to inet_aton. */
#cmakedefine NEED_INET_ATON_PROTO
/* Check for a prototype to inet_ntoa. */
#cmakedefine NEED_INET_NTOA_PROTO
/* Check for a prototype to listen. */
#cmakedefine NEED_LISTEN_PROTO
/* Check for a prototype to ntohl. */
#cmakedefine NEED_NTOHL_PROTO
/* Check for a prototype to perror. */
#cmakedefine NEED_PERROR_PROTO
/* Check for a prototype to printf. */
#cmakedefine NEED_PRINTF_PROTO
/* Check for a prototype to qsort. */
#cmakedefine NEED_QSORT_PROTO
/* Check for a prototype to read. */
#cmakedefine NEED_READ_PROTO
/* Check for a prototype to remove. */
#cmakedefine NEED_REMOVE_PROTO
/* Check for a prototype to rewind. */
#cmakedefine NEED_REWIND_PROTO
/* Check for a prototype to select. */
#cmakedefine NEED_SELECT_PROTO
/* Check for a prototype to setitimer. */
#cmakedefine NEED_SETITIMER_PROTO
/* Check for a prototype to setrlimit. */
#cmakedefine NEED_SETRLIMIT_PROTO
/* Check for a prototype to setsockopt. */
#cmakedefine NEED_SETSOCKOPT_PROTO
/* Check for a prototype to snprintf. */
#cmakedefine NEED_SNPRINTF_PROTO
/* Check for a prototype to socket. */
#cmakedefine NEED_SOCKET_PROTO
/* Check for a prototype to sprintf. */
#cmakedefine NEED_SPRINTF_PROTO
/* Check for a prototype to sscanf. */
#cmakedefine NEED_SSCANF_PROTO
/* Check for a prototype to strcasecmp. */
#cmakedefine NEED_STRCASECMP_PROTO
/* Check for a prototype to strdup. */
#cmakedefine NEED_STRDUP_PROTO
/* Check for a prototype to strerror. */
#cmakedefine NEED_STRERROR_PROTO
/* Check for a prototype to stricmp. */
#cmakedefine NEED_STRICMP_PROTO
/* Check for a prototype to strlcpy. */
#cmakedefine NEED_STRLCPY_PROTO
/* Check for a prototype to strncasecmp. */
#cmakedefine NEED_STRNCASECMP_PROTO
/* Check for a prototype to strnicmp. */
#cmakedefine NEED_STRNICMP_PROTO
/* Check for a prototype to system. */
#cmakedefine NEED_SYSTEM_PROTO
/* Check for a prototype to time. */
#cmakedefine NEED_TIME_PROTO
/* Check for a prototype to unlink. */
#cmakedefine NEED_UNLINK_PROTO
/* Check for a prototype to vsnprintf. */
#cmakedefine NEED_VSNPRINTF_PROTO
/* Check for a prototype to write. */
#cmakedefine NEED_WRITE_PROTO
#endif /* _CONF_H_ */

46
src/util/CMakeLists.txt Normal file
View file

@ -0,0 +1,46 @@
set(TOOLS
asciipasswd
autowiz
plrtoascii
rebuildIndex
rebuildMailIndex
shopconv
sign
split
wld2html
webster
)
# common includes and flags
include_directories(${CMAKE_SOURCE_DIR}/src)
add_definitions(-DCIRCLE_UTIL)
find_library(CRYPT_LIBRARY crypt)
find_library(NETLIB_LIBRARY nsl socket) # for sign.c, hvis nødvendig
foreach(tool ${TOOLS})
if(${tool} STREQUAL "rebuildIndex")
add_executable(rebuildIndex rebuildAsciiIndex.c)
else()
add_executable(${tool} ${tool}.c)
endif()
# Set output location
set_target_properties(${tool} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
)
# Link to libcrypt for asciipasswd
if(${tool} STREQUAL "asciipasswd" AND CRYPT_LIBRARY)
target_link_libraries(${tool} ${CRYPT_LIBRARY})
endif()
# Link to netlib for sign
if(${tool} STREQUAL "sign" AND NETLIB_LIBRARY)
target_link_libraries(${tool} ${NETLIB_LIBRARY})
endif()
endforeach()
add_custom_target(utils DEPENDS ${TOOLS})