Added config.h.in file

cmake generates a config file. It currently just shows the version.
rhosts now prints the version at start
stable
Justin Reichardt 2021-09-17 11:28:11 -05:00
parent f12ec08a46
commit 3ce1982af6
4 changed files with 8 additions and 1 deletions

View File

@ -2,5 +2,7 @@ cmake_minimum_required(VERSION 3.10)
project(rhosts VERSION 0.0.0 LANGUAGES C)
message(" C: '${CMAKE_C_COMPILER}'")
include_directories(${PROJECT_SOURCE_DIR})
add_executable(rhosts src/rhosts.c src/rhosts.h src/download.h src/download.c)
add_executable(rhosts src/rhosts.c src/download.c)
target_link_libraries(rhosts curl)
target_include_directories(rhosts PUBLIC "${PROJECT_BINARY_DIR}")
configure_file(src/rhostsConfig.h.in config.h)

View File

@ -27,6 +27,7 @@ int main(int argc, char *argv[]){
struct entry *entries;
int rc =0;
printf("version: %s\n",rhosts_VERSION);
rc = parse_config(&entries);
if (rc != 0){

View File

@ -21,6 +21,8 @@
#ifndef RHOSTS_HEADER
#define RHOSTS_HEADER
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

2
src/rhostsConfig.h.in Normal file
View File

@ -0,0 +1,2 @@
// the configured options and settings for Tutorial
#define rhosts_VERSION "@rhosts_VERSION@"