Skip to content

Commit 1f78767

Browse files
committed
Add CMakeLists.txt file and fix missing include<string>
1 parent 7c8a9e1 commit 1f78767

File tree

5 files changed

+51
-0
lines changed

5 files changed

+51
-0
lines changed

Diff for: CMakeLists.txt

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
project(CppDesignPatterns)
4+
5+
set(PATTERNS
6+
abstract-factory
7+
adapter
8+
bridge
9+
builder
10+
chain-of-responsibility
11+
command
12+
composite
13+
decorator
14+
facade
15+
factory-method
16+
flyweight
17+
interpreter
18+
iterator
19+
mediator
20+
memento
21+
observer
22+
prototype
23+
proxy
24+
singleton
25+
state
26+
strategy
27+
template-method
28+
visitor
29+
)
30+
31+
foreach(_dir IN ITEMS ${PATTERNS})
32+
file(GLOB _files "${_dir}/*.cpp")
33+
message(STATUS "Pattern `${_dir}':")
34+
35+
foreach(_file IN ITEMS ${_files})
36+
37+
get_filename_component(_file_name
38+
${_file} NAME
39+
)
40+
41+
set(_project_name "${_file_name}")
42+
message(STATUS " ${_dir}/${_file_name} is going to be built")
43+
44+
add_executable(${_project_name} "${_dir}/${_file_name}")
45+
endforeach()
46+
47+
endforeach()

Diff for: builder/Builder.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include <iostream>
12+
#include <string>
1213

1314
/*
1415
* Product

Diff for: factory-method/FactoryMethod.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include <iostream>
12+
#include <string>
1213

1314
/*
1415
* Product

Diff for: mediator/Mediator.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <iostream>
1212
#include <vector>
13+
#include <string>
1314

1415
class Mediator;
1516

Diff for: prototype/Prototype.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include <iostream>
12+
#include <string>
1213

1314
/*
1415
* Prototype

0 commit comments

Comments
 (0)