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
7 changed files with 892 additions and 17 deletions

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})