Skip to content

Commit a0285b7

Browse files
build: add CMake install targets and fix daemon path resolution
1 parent 926f4c5 commit a0285b7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@ add_executable(bsh-daemon
2121
src/db.cpp
2222
src/git_utils.cpp
2323
)
24-
target_link_libraries(bsh-daemon PRIVATE SQLiteCpp PkgConfig::LIBGIT2)
24+
target_link_libraries(bsh-daemon PRIVATE SQLiteCpp PkgConfig::LIBGIT2)
25+
26+
include(GNUInstallDirs)
27+
install(TARGETS bsh-daemon
28+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
29+
30+
install(FILES scripts/bsh_init.zsh
31+
DESTINATION ${CMAKE_INSTALL_DATADIR}/bsh)

scripts/bsh_init.zsh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ fi
5050

5151
_bsh_ensure_daemon() {
5252
if ! pgrep -x "bsh-daemon" > /dev/null; then
53-
if [[ -x "$BSH_REPO_ROOT/bin/bsh-daemon" ]]; then
53+
if command -v bsh-daemon >/dev/null 2>&1; then
54+
bsh-daemon &!
55+
elif [[ -x "$BSH_REPO_ROOT/bin/bsh-daemon" ]]; then
5456
"$BSH_REPO_ROOT/bin/bsh-daemon" &!
5557
elif [[ -x "$BSH_REPO_ROOT/build/bsh-daemon" ]]; then
5658
"$BSH_REPO_ROOT/build/bsh-daemon" &!

0 commit comments

Comments
 (0)