diff --git a/CMakeLists.txt b/CMakeLists.txt index c0dd1a5..716ee35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,25 @@ -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_LINUX TRUE) +elseif(APPLE) + set(XDBD_OSX TRUE) +elseif(WIN32) + set(XDBD_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 @@ -38,6 +54,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..2ed3dd5 --- /dev/null +++ b/cmake/xdbd_config.h.in @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright(c) 2024 John Sanpe + */ + +#ifndef __XDBD_CONFIG__H__ +#define __XDBD_CONFIG__H__ + +#cmakedefine XDBD_LINUX +#cmakedefine XDBD_OSX +#cmakedefine XDBD_WIN + +#endif /* __XDBD_CONFIG__H__ */