diff --git a/install/PackageConfig.cmake.in b/install/PackageConfig.cmake.in index 56524a8d9..670f5385a 100644 --- a/install/PackageConfig.cmake.in +++ b/install/PackageConfig.cmake.in @@ -41,8 +41,11 @@ if(NOT TARGET __zenohc_static) ) endif() -if(@BUILD_SHARED_LIBS@) - add_library(zenohc::lib ALIAS __zenohc_shared) -else() - add_library(zenohc::lib ALIAS __zenohc_static) +if(NOT TARGET zenohc::lib) + if(@BUILD_SHARED_LIBS@) + add_library(zenohc::lib ALIAS __zenohc_shared) + else() + add_library(zenohc::lib ALIAS __zenohc_static) + endif() endif() +