commit e3565f2b3999ead739066b33fa0fd346eb072d87
Author: Alexey Sokolov <sokolov@google.com>
Date:   Sun Oct 2 22:46:03 2022 +0100

    Support installing qt5 and qt6 versions in parallel

diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt
index 5640d8a..8d34020 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,8 @@ include(GNUInstallDirs)
 
-find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
 find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
+set(EXPORT_NAME QXlsxQt${QT_VERSION_MAJOR})
 
-if (QT_MAJOR_VERSION EQUAL 6)
+if (QT_VERSION_MAJOR EQUAL 6)
     set(CMAKE_CXX_STANDARD 17 CACHE STRING "")
 else()
     set(CMAKE_CXX_STANDARD 11 CACHE STRING "")
@@ -166,7 +167,7 @@ if (BUILD_SHARED_LIBS)
     target_compile_definitions(QXlsx PUBLIC QXlsx_SHAREDLIB)
 endif()
 
-target_link_libraries(${PROJECT_NAME}
+target_link_libraries(QXlsx
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::GuiPrivate
 )
@@ -180,39 +181,38 @@ PUBLIC
 )
 
 set_target_properties(QXlsx PROPERTIES
-    EXPORT_NAME QXlsx
+    OUTPUT_NAME ${EXPORT_NAME}
     VERSION ${PROJECT_VERSION}
     SOVERSION 0.${PROJECT_VERSION}
     PUBLIC_HEADER "${QXLSX_PUBLIC_HEADERS}"
 )
 
 install(TARGETS QXlsx
-    EXPORT QXlsxTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    EXPORT ${EXPORT_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel
     PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QXlsx COMPONENT devel
 )
 
-install(EXPORT QXlsxTargets
-    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QXlsx/
-    FILE QXlsxTargets.cmake
+install(EXPORT ${EXPORT_NAME}Targets
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}/
+    FILE ${EXPORT_NAME}Targets.cmake
     NAMESPACE QXlsx::
     COMPONENT devel
 )
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/qxlsx-config.cmake.in
-    ${CMAKE_CURRENT_BINARY_DIR}/QXlsxConfig.cmake
+    ${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}Config.cmake
     @ONLY
 )
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/qxlsx-config-version.cmake.in
-    ${CMAKE_CURRENT_BINARY_DIR}/QXlsxConfigVersion.cmake
+    ${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake
     @ONLY
 )
 install(
     FILES
-        ${CMAKE_CURRENT_BINARY_DIR}/QXlsxConfig.cmake
-        ${CMAKE_CURRENT_BINARY_DIR}/QXlsxConfigVersion.cmake
-    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QXlsx/
+        ${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}Config.cmake
+        ${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}/
 )
-
 include(CPackConfig)
diff --git a/QXlsx/cmake/modules/qxlsx-config.cmake.in b/QXlsx/cmake/modules/qxlsx-config.cmake.in
index 1aab813..d72276b 100644
--- a/cmake/modules/qxlsx-config.cmake.in
+++ b/cmake/modules/qxlsx-config.cmake.in
@@ -10,5 +10,5 @@
 SET(prefix "@CMAKE_INSTALL_PREFIX@")
 SET(exec_prefix "@CMAKE_INSTALL_PREFIX@")
 SET(QXlsx_FOUND "TRUE")
-    
-include("${CMAKE_CURRENT_LIST_DIR}/QXlsxTargets.cmake")
+
+include("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@Targets.cmake")
