From 9f821d9c6860d52c29e771c5b4f16fb9c8d02b24 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 17 Oct 2024 14:02:17 +0200 Subject: [PATCH] CMake: Don't attempt to create alias target if target of the same name already exists Fixes #2546. --- src/CMakeLists.template.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.template.cmake b/src/CMakeLists.template.cmake index 78377d753e..74942ebb7d 100644 --- a/src/CMakeLists.template.cmake +++ b/src/CMakeLists.template.cmake @@ -59,7 +59,11 @@ set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB TPL_SOURCES ${MODEL_DIR}/wrapfunctions.cpp) add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) -add_library(model ALIAS ${PROJECT_NAME}) + +# ${PROJECT_NAME} might already be "model" +if(NOT TARGET model) + add_library(model ALIAS ${PROJECT_NAME}) +endif() # Some special functions require boost #