0
votes

Is there a way to create install and package (I need a deb package) targets using CMake, where install path is read from some configuration file (e.g. /etc/myconfig.cfg) in install-time. I can do it using shell scripts, but I'd like to use CMake's and CPack's possibilities. I'd like a generated deb package to read myconfig.cfg in install time

A very simple example of start CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
project("My project")
add_executable(a.out main.cpp)

/etc/myconfig.cfg:

set(INSTALL_PATH "/var/path1")

or:

INSTALL_PATH = /var/path1

or something similar.

1

1 Answers

1
votes

Why not use CMAKE_INSTALL_PREFIX? For example:

cmake -DCMAKE_INSTALL_PREFIX=/usr/boob ..