From 8b6046f27e0380de4b6571b8f947bf7b657a4507 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 17 Oct 2024 12:31:39 +0200 Subject: [PATCH] CMake: Don't attempt to create alias target if the target of the same 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 #