add_library(lib-global SHARED IMPORTED GLOBAL) add_library(alias-lib-global ALIAS lib-global) add_library(lib-local SHARED IMPORTED) add_library(alias-lib-local ALIAS lib-local) add_library(lib SHARED IMPORTED) add_library(alias-lib ALIAS lib) # switch from local to global set_property (TARGET lib PROPERTY IMPORTED_GLOBAL TRUE) file(GENERATE OUTPUT alias_global.txt CONTENT "$($):$\n$($):$\n$($):$\n")