This repository was archived by the owner on Dec 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
76 lines (61 loc) · 1.4 KB
/
Copy pathCMakeLists.txt
File metadata and controls
76 lines (61 loc) · 1.4 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
cmake_minimum_required(VERSION 3.18)
project(libft_pain)
macro (install)
endmacro ()
enable_testing()
set(CMAKE_CXX_STANDARD 17)
include_directories(.)
# =============
# GTEST
# =============
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
include(GoogleTest)
# =============
# LIBFT
# =============
find_path(
LIBFT_FOLDER
NAMES libft
HINTS ./ ../
)
if(NOT LIBFT_FOLDER)
message(FATAL_ERROR "Can not find libft folder")
endif()
file(GLOB ft_SRC
${LIBFT_FOLDER}/libft/*.c
${LIBFT_FOLDER}/libft/*.h
)
add_library(
ft STATIC
${ft_SRC}
)
target_compile_definitions(ft PRIVATE malloc=malloc_pain free=free_pain)
target_compile_options(ft PRIVATE -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common -O1)
# =============
# MAKEFILE
# =============
# TODO potentially check Makefile here
# grep -r '<libft.h>' $LIBFT
# grep -r '\"stdlib.h\"' $LIBFT
# grep -r '\"unistd.h\"' $LIBFT
# grep -r '\"string.h\"' $LIBFT
# grep -r '\"stdio\"' $LIBFT
# Test the makefile potentially
# find_file(
# LIBFT_MAKEFILE
# NAMES makefile Makefile
# HINTS LIBFT_FOLDER
# )
# if(NOT LIBFT_MAKEFILE)
# message(WARNING "Can not find a makefile will build directly from source")
# endif()
# =============
# TESTS
# =============
add_subdirectory(src)