Added header guards for CMake add_subdirectory

This commit is contained in:
2026-07-08 08:50:46 +02:00
parent 54e4184840
commit f00a681652
2 changed files with 6 additions and 7 deletions
+5 -6
View File
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.03)
project(midas_lan_gpib VERSION 0.1)
# If the target already exists in a project (e.g. if midas_lan_gpib is included multiple time as a submodule of submodules),
# If the target already exists in a project (e.g. if lan_gpib_vxi11_linux_64bit 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 midas_lan_gpib)
return()
@@ -25,11 +25,6 @@ set(
$ENV{MIDASSYS}/drivers/class/generic.cxx
)
# guard against multiple include
if(NOT TARGET lan_gpib_vxi11_linux_64bit)
add_subdirectory(lan_gpib_vxi11)
endif()
set(SYS_LIBS
pthread
util
@@ -45,6 +40,10 @@ set(MIDAS_LIBS
set(LIBS ${SYS_LIBS} ${MIDAS_LIBS})
if(NOT TARGET lan_gpib_vxi11_linux_64bit)
add_subdirectory(lan_gpib_vxi11)
endif()
################################################################################
## Bus library
################################################################################