Skip to content

Commit

Permalink
Refactor CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Kaleta committed Apr 26, 2020
1 parent 83ad428 commit c02a63b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
20 changes: 9 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)
project(Traceroute VERSION 1.1.200119)

# PROPERTIES
set(INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
set(SRC_DIR "${PROJECT_SOURCE_DIR}/src")
set(EXE_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/bin")

# COMPILER
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unknown-pragmas -O2")

# SOURCES
include_directories(include)
set(SOURCES
src/IPAddress.cpp
src/ICMPController.cpp
src/SocketReceiver.cpp
src/SocketSender.cpp
src/traceroute.cpp)
include_directories("${INCLUDE_DIR}")

# OUTPUT
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
add_executable(traceroute ${SOURCES})
add_subdirectory("${SRC_DIR}")
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ When there are no replies, then a single asterisk character is displayed:
### Standard build & run
> *versions last used by the author are in double parentheses and italic*
Build process:
+ Linux-based operating system *((Debian testing))*
+ C++ compiler *((g++ 9.2.+))* \
\[APT package `g++` or `clang`\]
+ [CMake](https://cmake.org/) *((3.15.+))* \
\[APT package `cmake`\]
+ [GNU Make](https://www.gnu.org/software/make) *((4.2.+))* \
\[APT package `make`\]
General:
+ Linux-based operating system \
*((Debian testing))*
+ C++ compiler \
*((APT package `g++`, 9.2.+))*
+ [CMake](https://cmake.org/) \
*((APT package `cmake`, 3.15.+))*
+ [GNU Make](https://www.gnu.org/software/make) \
*((APT package `make`, 4.2.+))*

### Automated formatting
+ [Clang-format](https://releases.llvm.org/9.0.0/tools/clang/docs/ClangFormat.html) *((9.0.+))*\
\[APT package `clang-format`\]
+ [Clang-format](https://releases.llvm.org/9.0.0/tools/clang/docs/ClangFormat.html) \
*((APT package `clang-format`, 9.0.+))*

-----

Expand Down
13 changes: 13 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.10)

# SOURCES
set(SOURCES
IPAddress.cpp
ICMPController.cpp
SocketReceiver.cpp
SocketSender.cpp
traceroute.cpp)

# OUTPUT
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${EXE_OUTPUT_DIR}")
add_executable(traceroute ${SOURCES})

0 comments on commit c02a63b

Please sign in to comment.