mirror of
https://github.com/ohwgiles/laminar.git
synced 2025-06-13 12:54:29 +00:00
Move cmake defaults into CMakeLists.txt file, and document default(s).
This commit is contained in:
parent
09bfdb4eb9
commit
e574a4553a
@ -25,8 +25,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||||||
if(NOT CMAKE_INSTALL_PREFIX)
|
if(NOT CMAKE_INSTALL_PREFIX)
|
||||||
set(CMAKE_INSTALL_PREFIX /)
|
set(CMAKE_INSTALL_PREFIX /)
|
||||||
endif(NOT CMAKE_INSTALL_PREFIX)
|
endif(NOT CMAKE_INSTALL_PREFIX)
|
||||||
|
message("-- Install prefix set to '${CMAKE_INSTALL_PREFIX}'")
|
||||||
|
|
||||||
message("-- Install prefix set to ${CMAKE_INSTALL_PREFIX}")
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release )
|
||||||
|
endif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
message("-- Install type set to '${CMAKE_BUILD_TYPE}'")
|
||||||
|
|
||||||
add_definitions("-std=c++14 -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare")
|
add_definitions("-std=c++14 -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror -DDEBUG")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror -DDEBUG")
|
||||||
@ -120,20 +124,20 @@ install(TARGETS laminard laminarc RUNTIME DESTINATION usr/bin)
|
|||||||
install(FILES etc/laminar.service DESTINATION ${SYSTEMD_UNITDIR})
|
install(FILES etc/laminar.service DESTINATION ${SYSTEMD_UNITDIR})
|
||||||
|
|
||||||
# An initial attempt at solving https://github.com/ohwgiles/laminar/issues/92
|
# An initial attempt at solving https://github.com/ohwgiles/laminar/issues/92
|
||||||
if(NOT EXISTS "/etc/laminar.conf")
|
if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}etc/laminar.conf")
|
||||||
install(
|
install(
|
||||||
FILES etc/laminar.conf
|
FILES ${CMAKE_INSTALL_PREFIX}etc/laminar.conf
|
||||||
DESTINATION etc
|
DESTINATION etc
|
||||||
)
|
)
|
||||||
else()
|
else(NOT EXISTS "${CMAKE_INSTALL_PREFIX}etc/laminar.conf")
|
||||||
# hardcoded values are examples of technical debt, and in an ideal world, are eliminated.
|
# hardcoded values are examples of technical debt, and in an ideal world, are eliminated.
|
||||||
MESSAGE("-- An /etc/laminar.conf file exists, will create /etc/laminar.conf.example instead of overwriting.")
|
MESSAGE("-- A ${CMAKE_INSTALL_PREFIX}etc/laminar.conf file exists, will create ${CMAKE_INSTALL_PREFIX}etc/laminar.conf.example instead of overwriting.")
|
||||||
# This also displays at config time, rather than install time.
|
# This also displays at config time, rather than install time.
|
||||||
# In an ideal world, the user gets offered the option to overwrite, compare, or keep/copy the file
|
# In an ideal world, the user gets offered the option to overwrite, compare, or keep/copy the file
|
||||||
install(
|
install(
|
||||||
FILES etc/laminar.conf
|
FILES ${CMAKE_INSTALL_PREFIX}etc/laminar.conf
|
||||||
DESTINATION etc
|
DESTINATION etc
|
||||||
RENAME "laminar.conf.example"
|
RENAME "laminar.conf.example"
|
||||||
)
|
)
|
||||||
endif()
|
endif(NOT EXISTS "${CMAKE_INSTALL_PREFIX}etc/laminar.conf")
|
||||||
|
|
||||||
|
@ -15,10 +15,13 @@ First install development packages for `capnproto (version 0.7.0 or newer)`, `ra
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/ohwgiles/laminar.git
|
git clone https://github.com/ohwgiles/laminar.git
|
||||||
cd laminar
|
cd laminar
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/
|
cmake .
|
||||||
make -j4
|
make -j4
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
Note that by default, installing with `(c)make` will overwrite your existing configuration, binary, and unit files. Make backups!
|
||||||
|
|
||||||
|
The CMakeLists.txt file sets `cmake` defaults to `CMAKE_INSTALL_PREFIX=/` and `CMAKE_BUILD_TYPE=Release`, which can be overridden with the `-DCMAKE_INSTALL_PREFIX=<path>` and `-DCMAKE_BUILD_TYPE=<type>` flags, respectively.
|
||||||
|
|
||||||
`make install` includes a systemd unit file. If you intend to use it, consider creating a new user `laminar` or modifying the user specified in the unit file.
|
`make install` includes a systemd unit file. If you intend to use it, consider creating a new user `laminar` or modifying the user specified in the unit file.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user