diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-08-31 10:28:37 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-08-31 10:28:37 -0400 |
commit | b0acd4e5705fc4c28d4a42cde86dae7a433a2f95 (patch) | |
tree | 2ce25d03d971abb40db416d5da1373ab07005bc5 | |
parent | d258299bcb440e570e0c1d05538e05e259cff0bf (diff) | |
download | multihome-b0acd4e5705fc4c28d4a42cde86dae7a433a2f95.tar.gz |
Bake in path to rsync a compile-time
-rw-r--r-- | CMakeLists.txt | 18 | ||||
-rw-r--r-- | config.h.in | 1 | ||||
-rw-r--r-- | multihome.h | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3de427f..af22806 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ include(CheckCSourceCompiles) set(CMAKE_C_STANDARD 99) -include_directories(.) +include_directories("${CMAKE_CURRENT_BINARY_DIR}") check_symbol_exists(basename "libgen.h" HAVE_BASENAME) check_symbol_exists(dirname "libgen.h" HAVE_DIRNAME) @@ -16,20 +16,20 @@ check_c_source_compiles( " #include <argp.h> int main(int argc, char *argv[]) { - struct argp_option option[10]; + struct argp_option option[1]; } " HAVE_ARGP ) -if (NOT HAVE_ARGP) - message(FATAL_ERROR "Your toolchain does not provide argp") -endif() -find_program(PROGRAM_RSYNC rsync REQUIRED) +find_program(RSYNC_BIN + NAMES rsync + REQUIRED) + +configure_file("config.h.in" "config.h" @ONLY) add_executable(multihome - multihome.c - multihome.h) + multihome.c) install(TARGETS multihome - RUNTIME DESTINATION bin)
\ No newline at end of file + RUNTIME DESTINATION bin) diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..6007830 --- /dev/null +++ b/config.h.in @@ -0,0 +1 @@ +#cmakedefine RSYNC_BIN "@RSYNC_BIN@" diff --git a/multihome.h b/multihome.h index 5943b4e..c08401c 100644 --- a/multihome.h +++ b/multihome.h @@ -19,11 +19,11 @@ #include <wait.h> #include <argp.h> #include <time.h> +#include "config.h" #define VERSION "0.0.1" #define MULTIHOME_ROOT "home_local" #define OS_SKEL_DIR "/etc/skel/" // NOTE: Trailing slash is required -#define RSYNC_BIN "/usr/bin/rsync" #define RSYNC_ARGS "-aq" #endif //MULTIHOME_MULTIHOME_H |