Skip to content

Commit 0b4f807

Browse files
author
elkaboussi
committed
add support for cmake
1 parent 408197b commit 0b4f807

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# MINISHEL
1+
# MINIBASh
22
bin/
3+
build/
34
minibash
45
venv/
56
.vscode/

CMakeLists.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(minibash C)
3+
4+
set(CMAKE_C_STANDARD 11)
5+
6+
# Find the readline library
7+
find_library(READLINE_LIBRARY NAMES readline)
8+
9+
if(READLINE_LIBRARY)
10+
message(STATUS "Readline library found: ${READLINE_LIBRARY}")
11+
set(READLINE_FOUND TRUE)
12+
else()
13+
message(FATAL_ERROR "Readline library not found")
14+
endif()
15+
16+
# Include directories
17+
include_directories(includes)
18+
19+
# Source files
20+
file(GLOB_RECURSE SOURCE_FILES main.c helpers/*.c builtins/*.c execution/*.c parsing/*.c utils/*.c)
21+
22+
# Executable
23+
add_executable(minibash ${SOURCE_FILES})
24+
25+
# Link readline library
26+
target_link_libraries(minibash ${READLINE_LIBRARY})

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
### Setup
22
1. Install readline library and some extra dependencies
33
`sudo apt-get install lib32readline8 lib32readline-dev make git gcc`
4-
2. Clone the repository
4+
2. Clone the repository
55
`git clone https://github.com/fortytwobytes/minibash && cd minibash`
66
3. Compile and run the program
7-
`make && ./minibash`
7+
- with Cmake
8+
`dir -p build && (cd build && cmake .. && make && ./minibash)`
9+
- with Makefile
10+
`make && ./minibash`
811

0 commit comments

Comments
 (0)