diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 1aafa4a983..3d93ac9e09 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -334,6 +334,7 @@ macro(wx_add_library name) endif() add_library(${name} ${wxBUILD_LIB_TYPE} ${src_files}) + add_library(wx::${name} ALIAS ${name}) wx_set_target_properties(${name} ${wxADD_LIBRARY_IS_BASE}) # Setup install @@ -501,7 +502,15 @@ endfunction() # Add a third party builtin library function(wx_add_builtin_library name) wx_list_add_prefix(src_list "${wxSOURCE_DIR}/" ${ARGN}) + + if(${name} MATCHES "wx.*") + string(SUBSTRING ${name} 2 -1 name_short) + else() + set(name_short ${name}) + endif() + add_library(${name} STATIC ${src_list}) + add_library(wx::${name_short} ALIAS ${name}) wx_set_builtin_target_properties(${name}) if(wxBUILD_SHARED) set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/build/cmake/policies.cmake b/build/cmake/policies.cmake index 14aaeef17a..1a7415d0e1 100644 --- a/build/cmake/policies.cmake +++ b/build/cmake/policies.cmake @@ -14,6 +14,11 @@ if(POLICY CMP0025) cmake_policy(SET CMP0025 NEW) endif() +if(POLICY CMP0028) + # Double colon in target name means ALIAS or IMPORTED target. + cmake_policy(SET CMP0028 NEW) +endif() + if(POLICY CMP0038) # targets may not link directly to themselves cmake_policy(SET CMP0038 NEW)