From 3d68e40c8d733e511d3f9e665fbdcb1f044e658b Mon Sep 17 00:00:00 2001 From: mathis_s Date: Thu, 7 May 2026 11:34:08 +0200 Subject: [PATCH] Added "header guard" to prevent multiple definitions of the library target. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bf7757..3515ca6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.03) project(tcpip VERSION 0.1) +# If the target already exists in a project (e.g. if tcpip is included multiple time as a submodule of submodules), +# this "header guard"-style check prevents defining the same target multiple times (which will lead to CMake errors). +if(TARGET tcpip) + return() +endif() + add_compile_options( -Wall -Wformat=2