Skip to content

Instantly share code, notes, and snippets.

@antonxo
Created December 19, 2019 07:19
Show Gist options
  • Save antonxo/c0d243b3f3ad7883847127f8c056946c to your computer and use it in GitHub Desktop.
Save antonxo/c0d243b3f3ad7883847127f8c056946c to your computer and use it in GitHub Desktop.
CMakeLists.txt simple example (link executable with existing library)
cmake_minimum_required(VERSION 3.6)
project(ft_ls)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wextra -g")
link_directories(libft) # libraries
include_directories(inc libft/includes) # headers
set(SOURCE_FILES
inc/ft_ls.h
src/main.c
src/ft_ls.c
src/parse_input.c
src/flags.c
src/sort.c
src/output.c
src/error.c
src/help_funcs.c
src/stat_routine.c
src/ft_ls_main_routine.c
src/stat_parse.c
src/long_output.c
src/sort_funcs.c) # sources
add_executable(ft_ls ${SOURCE_FILES}) # compilation
target_link_libraries(ft_ls -lft) # linkage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment