diff --git a/CMakeLists.txt b/CMakeLists.txt index 395f342..08d2e74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,4 +4,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) project(modern_cpp) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) +include_directories(inc) +add_definitions(-Wall -Wextra -Werror) add_executable(${PROJECT_NAME} ${SRC_LIST}) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..41a6fd1 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +#phony is used to specify that target is not a file +#(to avoid conflicts when there are files named clean or all) + +CXX = g++ +CXXFLAGS = -std=c++17 -Wall -Wextra -Werror +HEADERSFLAG = -Iinc + +SRCS = *.cpp +INCS = inc/*.hpp + +.PHONY: all +all: debug release + +debug: $(SRCS) $(INCS) + $(CXX) $(CXXFLAGS) $(HEADERSFLAG) -g -o $@ $(SRCS) + +release: $(SRCS) $(INCS) + $(CXX) $(CXXFLAGS) $(HEADERSFLAG) -O3 -o $@ $(SRCS) + +.PHONY: clean +clean: + rm debug release diff --git a/Circle.hpp b/inc/Circle.hpp similarity index 100% rename from Circle.hpp rename to inc/Circle.hpp diff --git a/Rectangle.hpp b/inc/Rectangle.hpp similarity index 100% rename from Rectangle.hpp rename to inc/Rectangle.hpp diff --git a/Shape.hpp b/inc/Shape.hpp similarity index 100% rename from Shape.hpp rename to inc/Shape.hpp diff --git a/Square.hpp b/inc/Square.hpp similarity index 100% rename from Square.hpp rename to inc/Square.hpp