Squashed 'third_party/gflags/' changes from f0523f1..7e70988

7e70988 fix: PVS Studio warnings
754d332 fix: No extern template declaration for MSVC <12.0
82456f2 fix: Declare FlagRegisterer c’tor explicit template instanations as extern in header
3e2e349 fix: Declare FALGS_no##name variables as static
c0b1add fix: Import with GFLAGS_USE_TARGET_NAMESPACE=ON
f1ea012 fix: Import with or without gflags:: namespace
b0c4cd2 fix: Define both 'gflags' and 'gflags::gflags' alias targets
04c8ce7 fix: Indentation, use spaces instead of real tabs
d4a050d Merge pull request #247 from Mizux/master
48677f9 fix missing-field-initializers warnings on gcc
6e53655 Fix V728 excessive check
cad38c9 Set postfixes for generated libraries based on buildtype
2c49763 Fix build on some clang variants
660603a doc: Update documentation on how to use Bazel
518267d Remove installation guide's recommendation to use Bazel's bind().
f7228d7 Use CMake namespace gflags:: for export and alias target
8b39845 Remove uneeded enable_test()
9ab4d11 Add VERSION to project
e292e04 Use += for appends
6d1c363 Add Bazel-on-Windows support
7759264 repair wrong namespace problem
2334846 Removed unused functions.
60784b5 Remove using ::fLS::clstring;
57ceb0e enh: Move CMake defines to separate header, unused by Bazel
7d36353 Fix typo in BUILD
aa2d0f7 fix: Remove obsolete and unused CleanFileName code
4663c80 cmake: Add convenience uninstall target (#221)
46f73f8 Release v2.2.1
66d4386 enh: AppVeyor builds with different toolchains (copied from gtest project)
6348ea9 fix: Check HAVE_STDINT_H or HAVE_INTTYPES_H for older MSVC versions
3d5bc48 git: Ignore symbolic links created by Bazel build tool
74603f5 fix: Static code analyzer error regarding strncmp with empty kRootDir string
4a694e8 Use inttypes.h on VC++ 2013 and up
21c7bcd Fix CMake macro special variable usage (#216)
95ffb27 Fix static initialization order fiasco caused by global registry lock (#215)
80ebb42 Install dll's to correct path (#213)
652651b Fix statically linked gflags library with MSVC
9314597 Mark single argument constructors in mutex.h as explicit.
30dbc81 Changed include directory in bazel build
8935ef4 enh: Link to online documentation in README
20858a4 fix: Enable language C for older CMake versions when needed (#196)
ac6834e fix: Remove unused program_name variable
22ed2ce fix: Include utils by file instead of CMAKE_MODULE_PATH search
f8a0efe Release v2.2.0
2f336a2 doc: //external:gflags_nothreads Bazel target
c6b9377 git: Ignore builds/ subdirectory
84ab952 doc: Update use of gflags with Bazel documentation
b872d6b enh: Bazel BUILD, add WORKSPACE file (#192)
37c4c58 add: Bazel WORKSPACE file
37e2867 enh: Refactored Bazel BUILD rules
8f2c22a Revert "enh: Rename private sources, include public headers with rel path"
ea6144e enh: Rename private sources, include public headers with rel path
86d67a3 fix: Add -lpthread to link Bazel BUILD options (#189)
c94a60e enh: Configure and install pkg-config .pc file
3e7ef74 enh: Set GFLAGS_IS_A_DLL in INTERFACE_COMPILE_DEFINITIONS
1846983 fix: Ensure installation path uses forward slashes
3886da5 enh: Add option to add installation to CMake’s package registry
6c0ee00 fix: Copy missing IMPORTED_IMPLIB_<CONFIG> gflags target property
3064f63 enh: Avoid use of install(EXPORTS) FILE option
14c0e93 Convert dashes to underscores for unknown flags (#177)
cce68f0 Fix error messages to not truncate to 255 characters (#175)
f4eace1 fix: Validate modified flags only once (#173)
408061b fix make error for lacking namespace (#170)
7d31c02 Fix unsigned comparison error in gflags_reporting.cc (#168)
a69b254 Fix Windows linker errors and warnings. (#166)
15394d3 Add shared library build to the AppVeyor CI config. (#167)
e58e530 Remove filter for excluded tests from AppVeyor config. (#165)
435f949 test: Travis CI build static+shared in Release+Debug (#164)
22e4a53 fix: Run strip_flags_binary test only for release configurations (#163)
c713d2e test: Run AppVeyor build via cmake --build and run tests. (#162)
b16653e fix: Typo in gflags_strip_flags_test.cmake script
ec4b5da doc: Add AppVeyor status badge to README
f0be9c8 Add initial AppVeyor config. (#161)
78cab6c doc: Add Travis CI status badge to README
4667f41 Enable Travis CI for Linux and OSX builds (#160)
a5a1b28 Merge pull request #158 from dreamer-dead/use-type-name-enum
7ba9921 Fix wrong type comparison and outdated OfType() usage.
3051942 Fix indentation and remove outdated assert.
3c0ad4f Extract common code from FlagRegisterer to reduce size.
a1e461d Change template FlagValue::OfType() to Type() getter.
46ea10f Do not pass flag type as a char literal when registering a new flag.
fe57e5a Merge pull request #156 from dreamer-dead/fix-flag-value-typename
fa26638 Fix unittests expectations related to uint32.
5ef4c3c Fix uint32 type name.
2e4159f Merge pull request #155 from dreamer-dead/add-missing-reference
3e946c9 Add missing reference symbol to a function parameter.
546819b Merge pull request #152 from Liuchang0812/master
0c17f1e fix bug about LRLF
ac1a925 fix #151: Ubuntu package name in INSTALL instructions
d701cea Merge pull request #150 from LuminateWireless/fix-bazel-build
7ae23fd Add gendir to the include path so that building with bazel doesn't complain config.h can't be found.
8de80b9 Merge pull request #149 from hevy-CC4477/master
eff38cb fix test compilation
9353bca Merge pull request #147 from bazineta/master
81d8a92 Correct FV_MAX_INDEX
eaf0534 Support uint32 as flag type
74bcd20 Merge PR #137 with change of SOVERSION to <major>.<minor>
4534195 fix: Change SOVERSION to <major>.<minor> for 2.x release versions
5e30706 Merge pull request #143 from schuhschuh/fix-bazel-bulid-osx
687b2c5 fix #133: Use awk instead of sed which would require different options on OS X
5844199 Merge pull request #142 from schuhschuh/master
1c8285f mod: Update doc with new find_package COMPONENTS or subproject use
12d810d Merge pull request #141 from schuhschuh/master
389ef3f Merge branch 'master' of github.com:gflags/gflags
752c632 fix: Include order of config.h and gflags.h in unit test
f9e69b3 Merge pull request #140 from schuhschuh/enh-#117-gflags-subproject-support
7a21c16 cmake: Rename targets to gflags[_nothreads]_(static|shared), support find_package COMPONENTS
a4382e5 cmake: Require CMake 2.8.12 in NC tests
2de6bf3 cmake: Change CMake package configuration variable name prefix to GFLAGS_
91e16ee cmake: Add CMake variable to cache only when gflags is not a subproject
b686469 git: Add CMakeLists.txt.user Qt Creator configuration to ignore list
e50698c Merge pull request #139 from schuhschuh/master
18cb422 fix: Require CMake version 2.8.12 in test project
799e910 fix: Include private config.h in gflags_unittest.cc
abe4b10 fix: Package URLs
221f327 Revert "#136 Move test binaries to Testing/bin"
2a3454c fix: DLL import/export defines for unit tests, remove obsolete config_for_unittests.h
545e9df fix: Add missing include guards to gflags/config.h
6bd636c cmake: Clean up static library filename suffix code from PR #126
dd48d70 Merge pull request #126 from hevy-CC4477/master
9ef0d52 enh: Add usage of DEFINE_validator to test project
02f3189 #136 Move test binaries to Testing/bin
92865ce #51 #138 Use std::string instead const char * for global "constants"
8ac4bc4 fix: Pass std::string directly, no need for c_str() call
b90a325 properly export the .so minor version
3ae911f mod: Update doc
762f9cb #51 Call ShutDownCommandLineFlags for (manual) valgrind test
7a69001 #51 Use static StringFlagDestructor to destruct string objects allocated by placement new
3f968fc Merge pull request #133 from earhart/master
40b85b1 Add bazel support
f9fa305 Merge pull request #131 from sbc100/no_threads
b572a72 Define NO_THREADS in when building without threads
03bebcb Merge pull request #129 from Nazg-Gul/master
366e9d3 Fix some compilation warnings with MSVC 2015
4f100cb Resolve several missing declarations warnings
d78b00d handle generation of dynamic and static library on windows.
9db8289 #125 Fix unused typedef/variable warning for static assertion
4e61c45 #124 Remove using namespace from mutex.h

Change-Id: I61f02738b43ce97c825345375af77a44231165f4
git-subtree-dir: third_party/gflags
git-subtree-split: 7e709881881c2663569cd49a93e5c8d9228d868e
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index a7419c2..a512c2a 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -1,13 +1,27 @@
 ## gflags CMake configuration file
 
 # library version information
-set (@PACKAGE_NAME@_VERSION_STRING "@PACKAGE_VERSION@")
-set (@PACKAGE_NAME@_VERSION_MAJOR  @PACKAGE_VERSION_MAJOR@)
-set (@PACKAGE_NAME@_VERSION_MINOR  @PACKAGE_VERSION_MINOR@)
-set (@PACKAGE_NAME@_VERSION_PATCH  @PACKAGE_VERSION_PATCH@)
+set (@PACKAGE_PREFIX@_VERSION_STRING "@PACKAGE_VERSION@")
+set (@PACKAGE_PREFIX@_VERSION_MAJOR  @PACKAGE_VERSION_MAJOR@)
+set (@PACKAGE_PREFIX@_VERSION_MINOR  @PACKAGE_VERSION_MINOR@)
+set (@PACKAGE_PREFIX@_VERSION_PATCH  @PACKAGE_VERSION_PATCH@)
 
 # import targets
-include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-export.cmake")
+if (NOT DEFINED @PACKAGE_PREFIX@_USE_TARGET_NAMESPACE)
+  set (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE FALSE)
+endif ()
+if (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE)
+  include ("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@.cmake")
+  set (@PACKAGE_PREFIX@_TARGET_NAMESPACE @PACKAGE_NAME@)
+else ()
+  include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-nonamespace-targets.cmake")
+  set (@PACKAGE_PREFIX@_TARGET_NAMESPACE)
+endif ()
+if (@PACKAGE_PREFIX@_TARGET_NAMESPACE)
+  set (@PACKAGE_PREFIX@_TARGET_PREFIX ${@PACKAGE_PREFIX@_TARGET_NAMESPACE}::)
+else ()
+  set (@PACKAGE_PREFIX@_TARGET_PREFIX)
+endif ()
 
 # installation prefix
 get_filename_component (CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
@@ -18,94 +32,152 @@
 # Newer versions of CMake set the INTERFACE_INCLUDE_DIRECTORIES property
 # of the imported targets. It is hence not necessary to add this path
 # manually to the include search path for targets which link to gflags.
-set (@PACKAGE_NAME@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@")
+set (@PACKAGE_PREFIX@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@")
 
-# default settings
-if (NOT DEFINED @PACKAGE_NAME@_SHARED)
-  if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@_nothreads-static)
-    set (@PACKAGE_NAME@_SHARED FALSE)
+if (@PACKAGE_NAME@_FIND_COMPONENTS)
+  foreach (@PACKAGE_NAME@_FIND_COMPONENT IN LISTS @PACKAGE_NAME@_FIND_COMPONENTS)
+    if (@PACKAGE_NAME@_FIND_REQUIRED_${@PACKAGE_NAME@_FIND_COMPONENT} AND NOT TARGET @PACKAGE_NAME@_${@PACKAGE_NAME@_FIND_COMPONENT})
+      message (FATAL_ERROR "Package @PACKAGE_NAME@ was installed without required component ${@PACKAGE_NAME@_FIND_COMPONENT}!")
+    endif ()
+  endforeach ()
+  list (GET @PACKAGE_NAME@_FIND_COMPONENTS 0 @PACKAGE_NAME@_FIND_COMPONENT)
+else ()
+  set (@PACKAGE_NAME@_FIND_COMPONENT)
+endif ()
+
+# default settings of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS
+#
+# It is recommended to use either one of the following find_package commands
+# instead of setting the @PACKAGE_PREFIX@_(SHARED|NOTHREADS) variables:
+# - find_package(@PACKAGE_NAME@ REQUIRED)
+# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_static)
+# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_shared)
+# - find_package(@PACKAGE_NAME@ COMPONENTS static)
+# - find_package(@PACKAGE_NAME@ COMPONENTS shared)
+if (NOT DEFINED @PACKAGE_PREFIX@_SHARED)
+  if (DEFINED @PACKAGE_NAME@_SHARED)
+    set (@PACKAGE_PREFIX@_SHARED ${@PACKAGE_NAME@_SHARED})
+  elseif (@PACKAGE_NAME@_FIND_COMPONENT)
+    if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "shared")
+      set (@PACKAGE_PREFIX@_SHARED TRUE)
+    else ()
+      set (@PACKAGE_PREFIX@_SHARED FALSE)
+    endif ()
+  elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared)
+    set (@PACKAGE_PREFIX@_SHARED TRUE)
   else ()
-    set (@PACKAGE_NAME@_SHARED TRUE)
+    set (@PACKAGE_PREFIX@_SHARED FALSE)
   endif ()
 endif ()
-if (NOT DEFINED @PACKAGE_NAME@_NOTHREADS)
-  if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@-shared)
-    set (@PACKAGE_NAME@_NOTHREADS FALSE)
+if (NOT DEFINED @PACKAGE_PREFIX@_NOTHREADS)
+  if (DEFINED @PACKAGE_NAME@_NOTHREADS)
+    set (@PACKAGE_PREFIX@_NOTHREADS ${@PACKAGE_NAME@_NOTHREADS})
+  elseif (@PACKAGE_NAME@_FIND_COMPONENT)
+    if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "nothreads")
+      set (@PACKAGE_PREFIX@_NOTHREADS TRUE)
+    else ()
+      set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
+    endif ()
+  elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
+    set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
   else ()
-    set (@PACKAGE_NAME@_NOTHREADS TRUE)
+    set (@PACKAGE_PREFIX@_NOTHREADS TRUE)
   endif ()
 endif ()
 
 # choose imported library target
-if (NOT @PACKAGE_NAME@_TARGET)
-  if (@PACKAGE_NAME@_SHARED)
-    if (@PACKAGE_NAME@_NOTHREADS)
-      set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@_nothreads-shared)
+if (NOT @PACKAGE_PREFIX@_TARGET)
+  if (@PACKAGE_NAME@_TARGET)
+    set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_NAME@_TARGET})
+  elseif (@PACKAGE_PREFIX@_SHARED)
+    if (@PACKAGE_PREFIX@_NOTHREADS)
+      set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared)
     else ()
-      set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@-shared)
+      set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
     endif ()
   else ()
-    if (@PACKAGE_NAME@_NOTHREADS)
-      set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@_nothreads-static)
+    if (@PACKAGE_PREFIX@_NOTHREADS)
+      set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_static)
     else ()
-      set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@-static)
+      set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_static)
     endif ()
   endif ()
 endif ()
-if (NOT TARGET ${@PACKAGE_NAME@_TARGET})
-  message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_NAME@_TARGET} library target!"
-                       " Try a different combination of @PACKAGE_NAME@_SHARED and @PACKAGE_NAME@_NOTHREADS.")
+if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET})
+  message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_PREFIX@_TARGET} library target!"
+                       " Try a different combination of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS.")
 endif ()
 
-# add more convenient "@PACKAGE_NAME@" import target
-if (NOT TARGET @PACKAGE_NAME@)
-  if (@PACKAGE_NAME@_SHARED)
-    add_library (@PACKAGE_NAME@ SHARED IMPORTED)
+# add more convenient "${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@" import target
+if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@)
+  if (@PACKAGE_PREFIX@_SHARED)
+    add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ SHARED IMPORTED)
   else ()
-    add_library (@PACKAGE_NAME@ STATIC IMPORTED)
+    add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ STATIC IMPORTED)
   endif ()
-  # INTERFACE_INCLUDE_DIRECTORIES
-  get_target_property (_@PACKAGE_NAME@_INCLUDES ${@PACKAGE_NAME@_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
-  if (_@PACKAGE_NAME@_INCLUDES)
-    set_target_properties(@PACKAGE_NAME@ PROPERTIES
-      INTERFACE_INCLUDE_DIRECTORIES "${_@PACKAGE_NAME@_INCLUDES}"
-    )
-  endif ()
-  unset (_@PACKAGE_NAME@_INCLUDES)
-  # set configuration specific properties
-  get_target_property (_@PACKAGE_NAME@_CONFIGURATIONS ${@PACKAGE_NAME@_TARGET} IMPORTED_CONFIGURATIONS)
-  set_target_properties (@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_NAME@_CONFIGURATIONS}")
-  foreach (_@PACKAGE_NAME@_CONFIG IN LISTS _@PACKAGE_NAME@_CONFIGURATIONS)
-    # IMPORTED_LOCATION_<config>
-    get_target_property (_@PACKAGE_NAME@_LOCATION ${@PACKAGE_NAME@_TARGET} IMPORTED_LOCATION_${_@PACKAGE_NAME@_CONFIG})
-    if (_@PACKAGE_NAME@_LOCATION)
-      set_target_properties(@PACKAGE_NAME@ PROPERTIES
-        IMPORTED_LOCATION_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_LOCATION}"
+  # copy INTERFACE_* properties
+  foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS
+    COMPILE_DEFINITIONS
+    COMPILE_FEATURES
+    COMPILE_OPTIONS
+    INCLUDE_DIRECTORIES
+    LINK_LIBRARIES
+    POSITION_INDEPENDENT_CODE
+  )
+    get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME})
+    if (_@PACKAGE_PREFIX@_PROPERTY_VALUE)
+      set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES
+        INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}"
       )
     endif ()
-    unset (_@PACKAGE_NAME@_LOCATION)
-    # IMPORTED_LINK_INTERFACE_LANGUAGES_<config> (static)
-    get_target_property (_@PACKAGE_NAME@_LANGUAGES ${@PACKAGE_NAME@_TARGET} IMPORTED_LINK_INTERFACE_LANGUAGES_${_@PACKAGE_NAME@_CONFIG})
-    if (_@PACKAGE_NAME@_LANGUAGES)
-      set_target_properties(@PACKAGE_NAME@ PROPERTIES
-        IMPORTED_LINK_INTERFACE_LANGUAGES_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_LANGUAGES}"
-      )
-    endif ()
-    unset (_@PACKAGE_NAME@_LANGUAGES)
-    # IMPORTED_SONAME_<config> (shared)
-    get_target_property (_@PACKAGE_NAME@_SONAME ${@PACKAGE_NAME@_TARGET} IMPORTED_SONAME_${_@PACKAGE_NAME@_CONFIG})
-    if (_@PACKAGE_NAME@_SONAME)
-      set_target_properties(@PACKAGE_NAME@ PROPERTIES
-        IMPORTED_SONAME_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_SONAME}"
-      )
-    endif ()
-    unset (_@PACKAGE_NAME@_SONAME)
   endforeach ()
-  unset (_@PACKAGE_NAME@_CONFIGURATIONS)
+  # copy IMPORTED_*_<CONFIG> properties
+  get_target_property (_@PACKAGE_PREFIX@_CONFIGURATIONS ${@PACKAGE_PREFIX@_TARGET} IMPORTED_CONFIGURATIONS)
+  set_target_properties (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_PREFIX@_CONFIGURATIONS}")
+  foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS
+    IMPLIB
+    LOCATION
+    LINK_DEPENDENT_LIBRARIES
+    LINK_INTERFACE_LIBRARIES
+    LINK_INTERFACE_LANGUAGES
+    LINK_INTERFACE_MULTIPLICITY
+    NO_SONAME
+    SONAME
+  )
+    foreach (_@PACKAGE_PREFIX@_CONFIG IN LISTS _@PACKAGE_PREFIX@_CONFIGURATIONS)
+      get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG})
+      if (_@PACKAGE_PREFIX@_PROPERTY_VALUE)
+        set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES
+          IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}"
+        )
+      endif ()
+    endforeach ()
+  endforeach ()
+  unset (_@PACKAGE_PREFIX@_CONFIGURATIONS)
+  unset (_@PACKAGE_PREFIX@_CONFIG)
+  unset (_@PACKAGE_PREFIX@_PROPERTY_NAME)
+  unset (_@PACKAGE_PREFIX@_PROPERTY_VALUE)
 endif ()
 
 # alias for default import target to be compatible with older CMake package configurations
-set (@PACKAGE_NAME@_LIBRARIES "${@PACKAGE_NAME@_TARGET}")
+set (@PACKAGE_PREFIX@_LIBRARIES "${@PACKAGE_PREFIX@_TARGET}")
+
+# set @PACKAGE_NAME@_* variables for backwards compatibility
+if (NOT "^@PACKAGE_NAME@$" STREQUAL "^@PACKAGE_PREFIX@$")
+  foreach (_@PACKAGE_PREFIX@_VARIABLE IN ITEMS
+    VERSION_STRING
+    VERSION_MAJOR
+    VERSION_MINOR
+    VERSION_PATCH
+    INCLUDE_DIR
+    LIBRARIES
+    TARGET
+  )
+    set (@PACKAGE_NAME@_${_@PACKAGE_PREFIX@_VARIABLE} "${@PACKAGE_PREFIX@_${_@PACKAGE_PREFIX@_VARIABLE}}")
+  endforeach ()
+  unset (_@PACKAGE_PREFIX@_VARIABLE)
+endif ()
 
 # unset private variables
+unset (@PACKAGE_NAME@_FIND_COMPONENT)
 unset (_INSTALL_PREFIX)