Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pullchanges #4

Open
wants to merge 217 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
3f63c93
adding fuzz info
gladzeka May 31, 2023
eaa971c
findings
gladzeka May 31, 2023
16cbf54
Create manual.yml
gladzeka May 31, 2023
827657d
Update manual.yml
gladzeka May 31, 2023
84fe270
Update manual.yml
gladzeka May 31, 2023
ac3d6a6
addingID
gladzeka May 31, 2023
374059c
Create _cmake.yml
gladzeka May 31, 2023
cb05237
Create c-cpp.yml
gladzeka May 31, 2023
bce7a1c
Rename c-cpp.yml to c-c.yml
gladzeka May 31, 2023
4ea644e
Update c-c.yml
gladzeka May 31, 2023
e7b9a08
cheg
gladzeka May 31, 2023
bec46bb
Merge branch 'main' of https://github.com/gladzeka/TcpServer
gladzeka May 31, 2023
3c5888a
output
gladzeka May 31, 2023
f5a4781
Update manual.yml
gladzeka May 31, 2023
282333e
deliting cmkea
gladzeka May 31, 2023
abd00a2
del
gladzeka May 31, 2023
5e6d799
Merge branch 'main' of https://github.com/gladzeka/TcpServer
gladzeka May 31, 2023
e0a9b5c
adding actions fuzz
gladzeka May 31, 2023
fcf2467
adding buit my fuzz
gladzeka May 31, 2023
ab238ab
del
gladzeka May 31, 2023
4c7ef4c
add
gladzeka May 31, 2023
b57c512
t
gladzeka May 31, 2023
9af6f24
adding_start
gladzeka May 31, 2023
beac315
adding yml
gladzeka May 31, 2023
4842fd2
adding Integrator
gladzeka May 31, 2023
e1884a5
run1
gladzeka May 31, 2023
4c1f79f
cc
gladzeka May 31, 2023
1db3669
err
gladzeka May 31, 2023
0c464bc
ren
gladzeka May 31, 2023
a10447d
ch
gladzeka May 31, 2023
0baaea6
chaing
gladzeka May 31, 2023
6c88828
newActions
gladzeka May 31, 2023
797e33a
DelFuzz
gladzeka May 31, 2023
0920b1d
mod
gladzeka May 31, 2023
159f60b
Create cmake.yml
gladzeka May 31, 2023
6971332
addng
gladzeka May 31, 2023
2432b1c
t
gladzeka May 31, 2023
253b969
test
gladzeka May 31, 2023
d3b4e86
sum
gladzeka May 31, 2023
d45b251
cpcommand
gladzeka May 31, 2023
0d4a6a4
inde
gladzeka May 31, 2023
f93ffec
tcp
gladzeka May 31, 2023
09afece
usage
gladzeka May 31, 2023
d016786
rmv
gladzeka May 31, 2023
a302236
tt
gladzeka May 31, 2023
af67916
w
gladzeka May 31, 2023
7576aec
e
gladzeka May 31, 2023
2a54f5f
cod
gladzeka May 31, 2023
94e9469
en
gladzeka May 31, 2023
798b9b0
car
gladzeka May 31, 2023
0b57f8e
rnn
gladzeka May 31, 2023
258610e
beeeeg
gladzeka May 31, 2023
498c6e5
sudo
gladzeka May 31, 2023
5d42b7a
py
gladzeka May 31, 2023
b43bc8f
removepy
gladzeka May 31, 2023
676af9f
many
gladzeka May 31, 2023
d160b0d
more_
gladzeka May 31, 2023
6c3a2a9
tcp
gladzeka May 31, 2023
d2221fe
tudo
gladzeka May 31, 2023
d90fdb6
ggg
gladzeka May 31, 2023
2bca448
ss
gladzeka May 31, 2023
1b5542c
cd
gladzeka May 31, 2023
278dedb
bb
gladzeka May 31, 2023
46eaf62
#
gladzeka May 31, 2023
7f9d048
dubbio
gladzeka May 31, 2023
c8f4582
quindiiiiiiiiii
gladzeka May 31, 2023
05ec097
zzz
gladzeka May 31, 2023
e74f95b
many changes
gladzeka Jun 2, 2023
beefea8
coms
gladzeka Jun 2, 2023
6e247ff
all
gladzeka Jun 2, 2023
13fbba3
fuzz
gladzeka Jun 16, 2023
4061a39
changes
gladzeka Jun 17, 2023
7c3652a
Merge branch 'TestChironda' of https://github.com/gladzeka/TcpServer …
gladzeka Jun 17, 2023
d2e0628
Merge branch 'main' into TestChironda
gladzeka Jun 17, 2023
082e9e8
replacing
gladzeka Jun 17, 2023
247dcd0
add build
gladzeka Jun 17, 2023
19954a3
Merge branch 'TestChironda' of https://github.com/gladzeka/TcpServer …
gladzeka Jun 17, 2023
8cef552
te
gladzeka Jun 17, 2023
b7202cc
cs
gladzeka Jun 17, 2023
35188ce
aaa
gladzeka Jun 17, 2023
694b9af
add build
gladzeka Jun 17, 2023
8947c53
variazionebuild
gladzeka Jun 17, 2023
621fab1
Merge pull request #2 from gladzeka/ChirondaTestBranchFuzz
gladzeka Jun 17, 2023
5c8352e
Update Vulnerability.yml
gladzeka Jun 17, 2023
59cce6c
Create cmake.yml
gladzeka Jun 17, 2023
56e6cdc
msg
gladzeka Jun 18, 2023
45978ae
seninf
gladzeka Jun 18, 2023
7e3cb17
iotaaa
gladzeka Jun 18, 2023
3785d3d
mdo
gladzeka Jun 18, 2023
5d0de3b
main
gladzeka Jun 18, 2023
28439c4
change2
gladzeka Jun 18, 2023
b6eb5fa
ref
gladzeka Jun 18, 2023
96e6c67
modific2
gladzeka Jun 18, 2023
4bd9186
runserver
gladzeka Jun 18, 2023
e5ce262
remove1
gladzeka Jun 18, 2023
acb02b1
fix_2
gladzeka Jun 18, 2023
651daeb
fix_3
gladzeka Jun 18, 2023
fa73737
fix_4
gladzeka Jun 18, 2023
f25fc55
back_1
gladzeka Jun 18, 2023
4b8d8c2
mkdir
gladzeka Jun 18, 2023
2750cd8
ttt
gladzeka Jun 18, 2023
e550f17
treyt
gladzeka Jun 18, 2023
82024d8
ocm
gladzeka Jun 18, 2023
1840f7f
run simple
gladzeka Jun 18, 2023
8550c6b
vai
gladzeka Jun 18, 2023
e8d8c57
checkaclut
gladzeka Jun 18, 2023
f81593e
ora
gladzeka Jun 18, 2023
b81b03d
checkout
gladzeka Jun 18, 2023
298ce8f
add build
gladzeka Jun 18, 2023
2dd5806
di
gladzeka Jun 18, 2023
78f642e
slah
gladzeka Jun 18, 2023
2203011
copycmake
gladzeka Jun 18, 2023
9da23db
ved
gladzeka Jun 18, 2023
d2a608c
ttttttt
gladzeka Jun 18, 2023
6fffa29
step1
gladzeka Jun 18, 2023
54e8744
dir
gladzeka Jun 18, 2023
0204e91
stp2
gladzeka Jun 18, 2023
cead186
cmake
gladzeka Jun 18, 2023
9158f9a
bld
gladzeka Jun 18, 2023
e72f240
rmv
gladzeka Jun 18, 2023
7f4f27a
rmvvvvv
gladzeka Jun 18, 2023
0b71ef9
addmake
gladzeka Jun 18, 2023
472cfbf
cmake
gladzeka Jun 18, 2023
db50bf3
comments
gladzeka Jun 18, 2023
c6aabff
rmv2
gladzeka Jun 18, 2023
97201cf
te
gladzeka Jun 18, 2023
9e2b48c
cifff
gladzeka Jun 18, 2023
152eea5
remv3
gladzeka Jun 18, 2023
9c65adc
cccc
gladzeka Jun 18, 2023
5ad5937
original
gladzeka Jun 18, 2023
b6ca5fe
trynow
gladzeka Jun 18, 2023
f20fafa
targer
gladzeka Jun 18, 2023
403b7ae
b
gladzeka Jun 18, 2023
c2eb873
punto
gladzeka Jun 18, 2023
b2cc1b7
tm2
gladzeka Jun 18, 2023
eff57a6
instrumentations
gladzeka Jun 18, 2023
a4d59c9
Create example.yml
gladzeka Jun 18, 2023
fe9bf6f
di
gladzeka Jun 18, 2023
5f6fd79
se
gladzeka Jun 18, 2023
2a85269
viaaa
gladzeka Jun 18, 2023
0ae7f50
modifiche
gladzeka Jun 18, 2023
82a5de5
all
gladzeka Jun 18, 2023
e6d39ef
Update CMakeLists.txt
gladzeka Jun 18, 2023
7d88040
Update CMakeLists.txt
gladzeka Jun 18, 2023
c632bf6
adding correct client.cpp
gladzeka Jun 18, 2023
d99bbd3
rmv
gladzeka Jun 18, 2023
16e2fb9
chang1
gladzeka Jun 18, 2023
a6ae81b
vediamo
gladzeka Jun 18, 2023
7c2af59
vul_1
gladzeka Jun 18, 2023
469bdb0
CA
gladzeka Jun 18, 2023
cc3c5e5
UPS
gladzeka Jun 18, 2023
aaf472d
NT
gladzeka Jun 18, 2023
10cfd41
SVAI
gladzeka Jun 18, 2023
7ae036a
bast
gladzeka Jun 18, 2023
03cafee
tre
gladzeka Jun 18, 2023
f98ba1d
trrrr
gladzeka Jun 18, 2023
0a86eb4
bod
gladzeka Jun 18, 2023
4cca549
mmmm
gladzeka Jun 18, 2023
c15237d
ops
gladzeka Jun 19, 2023
a13f687
Client
gladzeka Jun 19, 2023
b3047cc
percentual
gladzeka Jun 19, 2023
0f57718
tcp_client
gladzeka Jun 19, 2023
2ebdc8b
send msg
gladzeka Jun 19, 2023
57c1a42
send msg
gladzeka Jun 19, 2023
14d4f30
test
gladzeka Jun 19, 2023
5eb40e2
cat
gladzeka Jun 19, 2023
641902d
cat2
gladzeka Jun 19, 2023
22cbfba
list
gladzeka Jun 19, 2023
cd5f76b
cav
gladzeka Jun 19, 2023
6e287b3
bb
gladzeka Jun 19, 2023
2aed82d
add build
gladzeka Jun 19, 2023
e9905c6
letsgo
gladzeka Jun 19, 2023
3830945
double
gladzeka Jun 19, 2023
c710221
vedi
gladzeka Jun 19, 2023
7c67187
arg1
gladzeka Jun 19, 2023
1f1abbe
buru
gladzeka Jun 19, 2023
df63e37
chep
gladzeka Jun 19, 2023
e032dbd
jumo
gladzeka Jun 19, 2023
daae382
vaios
gladzeka Jun 19, 2023
8875296
vurios
gladzeka Jun 19, 2023
78bb4a7
Create start.txt
gladzeka Jun 19, 2023
fbaf647
it
gladzeka Jun 19, 2023
8072f2f
bbbb
gladzeka Jun 19, 2023
703b8b7
aa
gladzeka Jun 19, 2023
807ae2c
non
gladzeka Jun 19, 2023
5889022
error1
gladzeka Jun 19, 2023
136b1b1
vetttt
gladzeka Jun 19, 2023
cc186b0
one
gladzeka Jun 19, 2023
8fb7752
control22
gladzeka Jun 19, 2023
980d572
back
gladzeka Jun 19, 2023
e4509b4
test folder
gladzeka Jun 19, 2023
f6f0e2b
before
gladzeka Jun 19, 2023
dd49062
error
gladzeka Jun 19, 2023
766e22e
many
gladzeka Jun 19, 2023
4b75169
jump
gladzeka Jun 19, 2023
9c8fa9b
give a try
gladzeka Jun 19, 2023
d1e4c7c
fix_command
gladzeka Jun 19, 2023
2c28ae5
pipe
gladzeka Jun 19, 2023
0216c77
fix_1
gladzeka Jun 19, 2023
3a9ec0b
fix_2
gladzeka Jun 19, 2023
30a20da
fix_3
gladzeka Jun 19, 2023
18619cf
fix_4
gladzeka Jun 19, 2023
541c8c0
fix_4
gladzeka Jun 19, 2023
c2206f9
fix_6
gladzeka Jun 19, 2023
48f607b
fix_7
gladzeka Jun 19, 2023
7c7b2d9
fiz_8
gladzeka Jun 19, 2023
f212747
fix_9
gladzeka Jun 19, 2023
e8e3362
fix11
gladzeka Jun 19, 2023
1d5a2d7
err
gladzeka Jun 19, 2023
8102b45
val
gladzeka Jun 19, 2023
733e772
RES
gladzeka Jun 19, 2023
19cb092
dir
gladzeka Jun 19, 2023
05c94a2
res
gladzeka Jun 19, 2023
1faa68e
commandsError
gladzeka Jun 19, 2023
2f7f2dc
run2
gladzeka Jun 19, 2023
d581712
example
gladzeka Jun 19, 2023
d24c893
tr1
gladzeka Jun 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cifuzz-build/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1
Ciao
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]}
97 changes: 97 additions & 0 deletions .cifuzz-build/libfuzzer/address+undefined/CMakeCache.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# This is the CMakeCache file.
# For build in directory: /home/zacarias/Desktop/CodeIntelligence/TcpServer/TcpServer/.cifuzz-build/libfuzzer/address+undefined
# It was generated by CMake: /usr/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.

########################
# EXTERNAL cache entries
########################

//No help, variable specified on the command line.
CIFUZZ_ENGINE:UNINITIALIZED=libfuzzer

//No help, variable specified on the command line.
CIFUZZ_SANITIZERS:UNINITIALIZED=address;undefined

//No help, variable specified on the command line.
CIFUZZ_TESTING:BOOL=ON

//No help, variable specified on the command line.
CMAKE_BUILD_RPATH_USE_ORIGIN:BOOL=ON

//No help, variable specified on the command line.
CMAKE_BUILD_TYPE:UNINITIALIZED=RelWithDebInfo

//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make

//Value Computed by CMake
CMAKE_PROJECT_DESCRIPTION:STATIC=

//Value Computed by CMake
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=

//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=TcpServer

//Value Computed by CMake
TcpServer_BINARY_DIR:STATIC=/home/zacarias/Desktop/CodeIntelligence/TcpServer/TcpServer/.cifuzz-build/libfuzzer/address+undefined

//Value Computed by CMake
TcpServer_IS_TOP_LEVEL:STATIC=ON

//Value Computed by CMake
TcpServer_SOURCE_DIR:STATIC=/home/zacarias/Desktop/CodeIntelligence/TcpServer/TcpServer


########################
# INTERNAL cache entries
########################

//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=/home/zacarias/Desktop/CodeIntelligence/TcpServer/TcpServer/.cifuzz-build/libfuzzer/address+undefined
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=22
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=3
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
//Path to cache edit program executable.
CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
//Generator instance identifier.
CMAKE_GENERATOR_INSTANCE:INTERNAL=
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Source directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=/home/zacarias/Desktop/CodeIntelligence/TcpServer/TcpServer
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//Platform information initialized
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.22
//uname command
CMAKE_UNAME:INTERNAL=/usr/bin/uname

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set(CMAKE_HOST_SYSTEM "Linux-5.4.0-110-generic")
set(CMAKE_HOST_SYSTEM_NAME "Linux")
set(CMAKE_HOST_SYSTEM_VERSION "5.4.0-110-generic")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")



set(CMAKE_SYSTEM "Linux-5.4.0-110-generic")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_VERSION "5.4.0-110-generic")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")

set(CMAKE_CROSSCOMPILING "FALSE")

set(CMAKE_SYSTEM_LOADED 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The system is: Linux - 5.4.0-110-generic - x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
Empty file.
124 changes: 124 additions & 0 deletions .github/workflows/Vulnerability.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Vulnerability Assessment

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches: [ main ]

env:
FUZZING_SERVER_ADDRESS: grpc.code-intelligence.com:443
WEB_APP_ADDRESS: https://app.code-intelligence.com
CHECKOUT_DIR: TcpServer/
CIFUZZ_DOWNLOAD_URL: "https://github.com/CodeIntelligenceTesting/cifuzz/releases/latest/download/cifuzz_installer_linux_amd64"
CIFUZZ_INSTALL_DIR: ./cifuzz
FUZZING_ARTIFACT: fuzzing-artifact.tar.gz
BUILD_TYPE: Release

jobs:
fuzz-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: gladzeka/TcpServer
ref: main

- name: Create Input.txt
run: |
echo "1" > input.txt
echo ",CIAO_Zac" >> input.txt
echo "2" >> input.txt
echo "FUZZ TEST RESULTS" > fuzz_results.txt


- name: Setup CMake
run: |
sudo apt-get install -y cmake

- name: Download CMakeLists.txt
run: |
curl -sSL -o CMakeLists.txt https://github.com/gladzeka/TcpServer/raw/main/CMakeLists.txt


- name: Create Destination Directory
run: |
mkdir -p ${{ env.CHECKOUT_DIR }}/build/
cp CMakeLists.txt ${{ env.CHECKOUT_DIR }}
ls ${{ env.CHECKOUT_DIR }}

- name: Create Fuzz Directory
run: |
mkdir -p ${{ env.CHECKOUT_DIR }}/results/
cp fuzz_results.txt ${{ env.CHECKOUT_DIR }}
ls ${{ env.CHECKOUT_DIR }}


- name: Install cifuzz
run: |
curl --fail --silent --show-error --location -o cifuzz_installer "$CIFUZZ_DOWNLOAD_URL"
chmod u+x cifuzz_installer
./cifuzz_installer --install-dir $CIFUZZ_INSTALL_DIR

- name: Setup Environment
run: |
sudo apt-get update

- name: Build Server
run: |
cmake .
cmake --build .

- name: List Directories
run: |
pwd && ls # display the working directory and List the files in the current directory


- name: Start Server
run: |
./tcp_server &

- name: Start Client
run: |
pwd && ls
cat input.txt | ./tcp_client
#echo "::set-output name=clientFinished::true"
continue-on-error: true

- name: Fuzz commands
run: |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/CodeIntelligenceTesting/cifuzz/main/install.sh)"
cifuzz init
cifuzz login
cifuzz run heap_buffer_overflow_test



- name: Start Fuzz
run: |
cp test/Fuzzing/inputvalidation.py .
python inputvalidation.py &

#cat input.txt | ./tcp_client
#echo -e "1\n Mio msg" | ./tcp_client
continue-on-error: true




- name: Save Fuzz Test Results
if: always()
run: |
# Save thee fuzzing test results to an artifact or a file for further analysis
cp fuzz_results.txt ${{ env.CHECKOUT_DIR }}/results/fuzz_results.txt

- name: Upload Fuzz Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Fuzz Test Results
path: ${{ env.CHECKOUT_DIR }}/results

15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"cmake.configureOnOpen": true,
"files.associations": {
"*.py": "python",
"*.txt": "plaintext",
"*.yml": "cpp",
"chrono": "cpp",
"system_error": "cpp",
"xlocale": "cpp",
"typeinfo": "cpp"
},
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
42 changes: 42 additions & 0 deletions CMakeLists - backup.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.8.1)
project(tcp_client_server)

find_package (Threads)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")

add_library(${PROJECT_NAME}
src/tcp_client.cpp
src/tcp_server.cpp
src/client.cpp
src/pipe_ret_t.cpp
src/common.cpp)

option(SERVER_EXAMPLE "Build SERVER" ON)

if(SERVER_EXAMPLE)

add_definitions(
-DSERVER_EXAMPLE
)

add_executable(tcp_server examples/server_example.cpp)

target_link_libraries (tcp_server ${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT})

endif()

option(CLIENT_EXAMPLE "Build CLIENT" ON)

if(CLIENT_EXAMPLE)

add_definitions(
-DCLIENT_EXAMPLE
)

add_executable(tcp_client examples/client_example.cpp)

target_link_libraries (tcp_client ${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT})

endif()
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8.1)
project(tcp_client_server)
cmake_minimum_required(VERSION 3.8.1)
project(TcpServer)

find_package (Threads)

Expand Down
Loading