-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
31 lines (25 loc) · 917 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
cmake_minimum_required(VERSION 3.14)
project(minishell C)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_FLAGS "-Wall -Wextra")
enable_testing()
add_subdirectory(libft)
add_subdirectory(tests)
# build readline
include(ExternalProject)
ExternalProject_Add(
gnu_readline
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/readline/lib/libreadline.a
PREFIX ${CMAKE_BINARY_DIR}/readline
SOURCE_DIR ${CMAKE_SOURCE_DIR}/readline
CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/readline/configure
-q --prefix=${CMAKE_BINARY_DIR}/readline --enable-shared=no
BUILD_COMMAND make
BUILD_IN_SOURCE 1
INSTALL_COMMAND make install
)
file(GLOB_RECURSE SRC src/*.c)
add_executable(minishell ${SRC})
add_dependencies(minishell gnu_readline)
target_include_directories(minishell PRIVATE src include ${CMAKE_BINARY_DIR}/readline/include)
target_link_libraries(minishell ft ${CMAKE_BINARY_DIR}/readline/lib/libreadline.a ncurses)