diff --git a/CMakeLists.txt b/CMakeLists.txt index c0dd1a5..c6ac35b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,27 @@ -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.25) project(adbd LANGUAGES C) include(cmake/bfdev.cmake) include(cmake/sanitize.cmake) +set(XDBD_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +set(XDBD_GENERATED_PATH ${PROJECT_BINARY_DIR}/generated) + +if(LINUX) + set(XDBD_CONFIG_LINUX TRUE) +elseif(APPLE) + set(XDBD_CONFIG_OSX TRUE) +elseif(WIN32) + set(XDBD_CONFIG_WIN TRUE) +endif() + +configure_file( + ${XDBD_MODULE_PATH}/xdbd_config.h.in + ${XDBD_GENERATED_PATH}/xdbd_config.h +) + set(HEADERS ${PROJECT_SOURCE_DIR}/include/xdbd.h - ${PROJECT_SOURCE_DIR}/include/xdbd_config.h ) set(SRCS @@ -38,6 +53,7 @@ set( ) include_directories(${XADB_INCLUDES}) +include_directories(${XDBD_GENERATED_PATH}) add_executable(adbd ${SRCS}) diff --git a/cmake/xdbd_config.h.in b/cmake/xdbd_config.h.in new file mode 100644 index 0000000..a77ada2 --- /dev/null +++ b/cmake/xdbd_config.h.in @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright(c) 2024 John Sanpe + */ + +#ifndef __XDBD_CONFIG__H__ +#define __XDBD_CONFIG__H__ + +#cmakedefine XDBD_CONFIG_LINUX +#cmakedefine XDBD_CONFIG_OSX +#cmakedefine XDBD_CONFIG_WIN + +#define XDBD_HAVE_SELECT 1 +#endif /* __XDBD_CONFIG__H__ */ diff --git a/include/xdbd_config.h b/include/xdbd_config.h deleted file mode 100644 index 806c379..0000000 --- a/include/xdbd_config.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __XDBD_CONFIG__H__ -#define __XDBD_CONFIG__H__ - -#define XDBD_HAVE_SELECT 1 - - -#endif /*__XDBD_CONFIG__H__*/