diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6e4b4b8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.5) + +project(CppDesignPatterns) + +set(PATTERNS + abstract-factory + adapter + bridge + builder + chain-of-responsibility + command + composite + decorator + facade + factory-method + flyweight + interpreter + iterator + mediator + memento + observer + prototype + proxy + singleton + state + strategy + template-method + visitor +) + +foreach(_dir IN ITEMS ${PATTERNS}) + file(GLOB _files "${_dir}/*.cpp") + message(STATUS "Pattern `${_dir}':") + + foreach(_file IN ITEMS ${_files}) + + get_filename_component(_file_name + ${_file} NAME + ) + + set(_project_name "${_file_name}") + message(STATUS " ${_dir}/${_file_name} is going to be built") + + add_executable(${_project_name} "${_dir}/${_file_name}") + endforeach() + +endforeach() diff --git a/builder/Builder.cpp b/builder/Builder.cpp index addd5be..bb0c6f7 100644 --- a/builder/Builder.cpp +++ b/builder/Builder.cpp @@ -9,6 +9,7 @@ */ #include +#include /* * Product diff --git a/factory-method/FactoryMethod.cpp b/factory-method/FactoryMethod.cpp index 68bd9a1..77ab3da 100644 --- a/factory-method/FactoryMethod.cpp +++ b/factory-method/FactoryMethod.cpp @@ -9,6 +9,7 @@ */ #include +#include /* * Product diff --git a/mediator/Mediator.cpp b/mediator/Mediator.cpp index 18b6384..7689bb0 100644 --- a/mediator/Mediator.cpp +++ b/mediator/Mediator.cpp @@ -10,6 +10,7 @@ #include #include +#include class Mediator; diff --git a/prototype/Prototype.cpp b/prototype/Prototype.cpp index 0bfce49..3060b0e 100644 --- a/prototype/Prototype.cpp +++ b/prototype/Prototype.cpp @@ -9,6 +9,7 @@ */ #include +#include /* * Prototype