]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change config file with cmake variable
authorBastian Dehn <hhaalo@arcor.de>
Sat, 9 Mar 2024 06:31:15 +0000 (07:31 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 9 Mar 2024 06:31:15 +0000 (07:31 +0100)
src/CMakeLists.txt
src/config.h.in
src/kds_s2000w_client.c

index 1de7846c64952aa211ca0608b89e9de23b73004a..c61ae94adf083b2ad2c6f1c9327a9f3c940fa06f 100644 (file)
@@ -19,8 +19,10 @@ cmake_path(GET SANE PARENT_PATH SANE_LIBRARY_PATH)
 message(STATUS "SANE_LIBRARY_PATH: " ${SANE_LIBRARY_PATH})
 set(SANE_LIBRARY_BACKEND_PATH ${SANE_LIBRARY_PATH}/sane CACHE STRING "sane library backend path")
 message(STATUS "SANE_LIBRARY_BACKEND_PATH: " ${SANE_LIBRARY_BACKEND_PATH})
-set(SANE_CONFIG_PATH "/etc/sane.d/" CACHE STRING "config path")
+set(SANE_CONFIG_PATH "/etc/sane.d" CACHE STRING "config path")
 message(STATUS "SANE_CONFIG_PATH: " ${SANE_CONFIG_PATH})
+set(CONFIG_FILE ${SANE_CONFIG_PATH}/kds_s2000w_net.conf CACHE STRING "sane kds-s2000w-net config path")
+message(STATUS "CONFIG_FILE: " ${CONFIG_FILE})
 
 configure_file(config.h.in config.h)
 
@@ -47,7 +49,7 @@ target_link_libraries("sane-kds_s2000w_net"
 install(TARGETS "sane-kds_s2000w_net"
        DESTINATION ${SANE_LIBRARY_BACKEND_PATH})
 
-if (NOT EXISTS "${SANE_CONFIG_PATH}/kds_s2000w_net.conf")
+if (NOT EXISTS ${SANE_CONFIG_PATH})
        install(FILES "kds_s2000w_net.conf"
                DESTINATION ${SANE_CONFIG_PATH})
 endif()
\ No newline at end of file
index 0c67101e6b3de514124c5f4ef934c99b16373b7c..d65590e08f90de7591247241b4cf1adecf634e00 100644 (file)
@@ -1,3 +1,4 @@
 #define MAJOR @PROJECT_VERSION_MAJOR@
 #define MINOR @PROJECT_VERSION_MINOR@
-#define PATCH @PROJECT_VERSION_PATCH@
\ No newline at end of file
+#define PATCH @PROJECT_VERSION_PATCH@
+#define CONFIG_FILE "@CONFIG_FILE@"
\ No newline at end of file
index d8b74d20740f720a88348e4ae5b6452a7aac50f3..ef189e1b99fdeeb345476576075fe4fc0cd38a1c 100644 (file)
@@ -1,6 +1,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <curl/curl.h>
+#include "config.h"
 #include "kds_s2000w_client.h"
 #include "kds_s2000w_debug.h"
 #include "kds_s2000w_config.h"
@@ -9,7 +10,7 @@ program_config p_config;
 
 void _kds_s2000w_client_load_config()
 {
-       const char* config_file = "/etc/sane.d/kds_s2000w_net.conf";
+       const char* config_file = CONFIG_FILE;
        char* config_stream = read_config_file(config_file);
        load_config(&p_config, config_stream);
 }