added config installation
authorFelix Morgner <felix.morgner@gmail.com>
Wed, 15 Jan 2014 16:21:24 +0000 (17:21 +0100)
committerFelix Morgner <felix.morgner@gmail.com>
Wed, 15 Jan 2014 16:21:24 +0000 (17:21 +0100)
The umurmur.example.config file gets installed into
${CMAKE_INSTALL_PREFIX}/etc so that it is automagically
found when starting umurmurd. Note, that the config file
is only installed when there is no old config file found
in this spot.

CMakeLists.txt

index d100472da0bdf790389ef63b5081882e89d27046..f0b38512fdfbd4c0a3e743fecaf51a94c2095db1 100644 (file)
@@ -50,7 +50,12 @@ include_directories(${LIBCONFIG_INCLUDE_DIR} ${PROTOBUFC_INCLUDE_DIR} ${SSLIMP_I
 link_directories(${LIBCONFIG_LIB_DIR} ${PROTOBUFC_LIB_DIR} ${SSLIMP_LIB_DIR})
 
 add_executable(umurmurd ${SOURCE})
-install(TARGETS umurmurd RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+install(TARGETS umurmurd RUNTIME DESTINATION "bin")
+
+find_path(OLD_CONFIG_FILE NAMES "umurmur.conf" PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "etc")
+if(NOT OLD_CONFIG_FILE)
+  install(FILES "umurmur.conf.example" DESTINATION "etc" RENAME "umurmur.conf")
+endif(NOT OLD_CONFIG_FILE)
 
 add_definitions(${SSLIMP_CFLAGS})
 target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${PROTOBUFC_LIBRARIES} ${SSLIMP_LIBRARIES} ${LIBRT})