Browse Source

Added the ability to select the location of the configuration file

master
Michael Uleysky 2 weeks ago
parent
commit
95d519c87b
  1. 5
      CMakeLists.txt
  2. 6
      include/ParseArgs.h
  3. 2
      src/ParseArgs.cpp

5
CMakeLists.txt

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.20)
# Make sure the user doesn't play dirty with symlinks
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
@ -41,6 +41,9 @@ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
include_directories(include sources sources-add GSW-C)
add_compile_options(-Wall -Wno-deprecated-declarations)
set(CONFIG_FILE "/etc/odm.conf" CACHE STRING "Path to config file")
add_compile_options(-DCONFIGFILE="${CONFIG_FILE}")
# Dwarf-4 support check
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-gdwarf-4 COMPILER_SUPPORTS_DWARF4)

6
include/ParseArgs.h

@ -5,5 +5,9 @@ using michlib::MString;
using michlib::SList;
using CLArgs = std::map<MString, MString>;
CLArgs ParseArgs(int argc, char** argv);
CLArgs ParseArgs(int argc, char** argv);
MString GetExt(const MString& fname);
#ifndef CONFIGFILE
#define CONFIGFILE "/etc/odm.conf"
#endif

2
src/ParseArgs.cpp

@ -29,7 +29,7 @@ CLArgs ParseArgs(int argc, char** argv)
}
SList sl;
michlib_internal::ParseParameterFile("/etc/odm.conf", sl, 0);
michlib_internal::ParseParameterFile(CONFIGFILE, sl, 0);
return out;
}

Loading…
Cancel
Save