Skip to content

Commit

Permalink
Remove absolute installation paths so that DLT can be installed at an…
Browse files Browse the repository at this point in the history
…y location (not only "/usr").

Signed-off-by: Jacques GUILLOU <[email protected]>
  • Loading branch information
jacky405 authored and alexmucde committed Apr 2, 2015
1 parent 2cec5d2 commit cb4950d
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 26 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}
configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT devel)

IF(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr")
set(CONFIGURATION_FILES_DIR "/etc")
ELSE()
set(CONFIGURATION_FILES_DIR "${CMAKE_INSTALL_PREFIX}/etc")
ENDIF()

add_definitions(-DCONFIGURATION_FILES_DIR="${CONFIGURATION_FILES_DIR}")

add_subdirectory( cmake )

if(WITH_SYSTEMD OR WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD_JOURNAL)
Expand Down
6 changes: 0 additions & 6 deletions examples/example1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
cmake_minimum_required( VERSION 2.6 )
project( automotive-dlt-example1 )

#
# set prefix
#

set( CMAKE_INSTALL_PREFIX "/usr" )

#
# find dependency packages
#
Expand Down
6 changes: 0 additions & 6 deletions examples/example2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
cmake_minimum_required( VERSION 2.6 )
project( automotive-dlt-example2 )

#
# set prefix
#

set( CMAKE_INSTALL_PREFIX "/usr" )

#
# find dependency packages
#
Expand Down
6 changes: 0 additions & 6 deletions examples/example3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
cmake_minimum_required( VERSION 2.6 )
project( automotive-dlt-example3 )

#
# set prefix
#

set( CMAKE_INSTALL_PREFIX "/usr" )

#
# find dependency packages
#
Expand Down
4 changes: 3 additions & 1 deletion src/daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ install(TARGETS dlt-daemon
WORLD_EXECUTE WORLD_READ
COMPONENT base)

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlt.conf DESTINATION /etc COMPONENT base)
INSTALL(FILES dlt.conf
DESTINATION ${CONFIGURATION_FILES_DIR}
COMPONENT base)
4 changes: 2 additions & 2 deletions src/daemon/dlt-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void usage()
printf("Options:\n");
printf(" -d Daemonize\n");
printf(" -h Usage\n");
printf(" -c filename DLT daemon configuration file (Default: /etc/dlt.conf)\n");
printf(" -c filename DLT daemon configuration file (Default: " CONFIGURATION_FILES_DIR "/dlt.conf)\n");
} /* usage() */

/**
Expand Down Expand Up @@ -196,7 +196,7 @@ int option_file_parser(DltDaemonLocal *daemon_local)
if(daemon_local->flags.cvalue[0])
filename = daemon_local->flags.cvalue;
else
filename = "/etc/dlt.conf";
filename = CONFIGURATION_FILES_DIR "/dlt.conf";
//printf("Load configuration from file: %s\n",filename);
pFile = fopen (filename,"r");

Expand Down
5 changes: 3 additions & 2 deletions src/dbus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ install(TARGETS dlt-dbus
RUNTIME DESTINATION bin
COMPONENT base)

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlt-dbus.conf DESTINATION /etc COMPONENT base)

INSTALL(FILES dlt-dbus.conf
DESTINATION ${CONFIGURATION_FILES_DIR}
COMPONENT base)
4 changes: 3 additions & 1 deletion src/system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ install(TARGETS dlt-system
RUNTIME DESTINATION bin
COMPONENT base)

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlt-system.conf DESTINATION /etc COMPONENT base)
INSTALL(FILES dlt-system.conf
DESTINATION ${CONFIGURATION_FILES_DIR}
COMPONENT base)
2 changes: 1 addition & 1 deletion src/system/dlt-system.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include "dlt_common.h"

// Constants
#define DEFAULT_CONF_FILE "/etc/dlt-system.conf"
#define DEFAULT_CONF_FILE ( CONFIGURATION_FILES_DIR "/dlt-system.conf")
#define DLT_SYSTEM_LOG_FILE_MAX 32
#define DLT_SYSTEM_LOG_DIRS_MAX 32
#define DLT_SYSTEM_LOG_PROCESSES_MAX 32
Expand Down
4 changes: 3 additions & 1 deletion src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ install(TARGETS dlt-test-multi-process dlt-test-multi-process-client dlt-test-us
RUNTIME DESTINATION bin
COMPONENT base)

INSTALL(FILES dlt-test-filetransfer-file dlt-test-filetransfer-image.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/dlt-filetransfer)
INSTALL(FILES dlt-test-filetransfer-file dlt-test-filetransfer-image.png
DESTINATION share/dlt-filetransfer
)

0 comments on commit cb4950d

Please sign in to comment.