From d258299bcb440e570e0c1d05538e05e259cff0bf Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 31 Aug 2020 10:10:06 -0400 Subject: Add platform checks --- CMakeLists.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 368e6ce..3de427f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,32 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.0) project(multihome C) +include(CheckSymbolExists) +include(CheckCSourceCompiles) set(CMAKE_C_STANDARD 99) include_directories(.) +check_symbol_exists(basename "libgen.h" HAVE_BASENAME) +check_symbol_exists(dirname "libgen.h" HAVE_DIRNAME) +check_symbol_exists(getpwuid "pwd.h" HAVE_GETPWUID) +check_symbol_exists(geteuid "unistd.h" HAVE_GETEUID) + +check_c_source_compiles( + " + #include + int main(int argc, char *argv[]) { + struct argp_option option[10]; + } + " + HAVE_ARGP +) +if (NOT HAVE_ARGP) + message(FATAL_ERROR "Your toolchain does not provide argp") +endif() + +find_program(PROGRAM_RSYNC rsync REQUIRED) + add_executable(multihome multihome.c multihome.h) -- cgit