Skip to content

<draft><fix>: clear warning on MSVC #393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions QXlsx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

if(NOT DEFINED QT_VERSION_MAJOR)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
Expand Down Expand Up @@ -174,7 +175,7 @@ PRIVATE
${QXLSX_HEADERPATH}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/header>
$<INSTALL_INTERFACE:include/QXlsxQt${QT_VERSION_MAJOR}>
$<INSTALL_INTERFACE:include/QXlsx>
)

set_target_properties(QXlsx PROPERTIES
Expand All @@ -184,32 +185,36 @@ set_target_properties(QXlsx PROPERTIES
PUBLIC_HEADER "${QXLSX_PUBLIC_HEADERS}"
)

set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}" )
install(TARGETS QXlsx
EXPORT ${EXPORT_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}
EXPORT ${EXPORT_NAME}Targets DESTINATION ${CMAKECONFIG_INSTALL_DIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QXlsxQt${QT_VERSION_MAJOR} COMPONENT devel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove QT_VERSION_MAJOR?

PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QXlsx COMPONENT devel
)

install(EXPORT ${EXPORT_NAME}Targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}/
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
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}/${EXPORT_NAME}Config.cmake
@ONLY
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/qxlsx-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CMAKECONFIG_INSTALL_DIR
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/qxlsx-config-version.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/qxlsx-config-version.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake"
@ONLY
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}/
"${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_NAME}ConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
)
include(CPackConfig)
16 changes: 11 additions & 5 deletions QXlsx/cmake/modules/qxlsx-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
# - Config information for QXlsx
# This file defines:
#
# QXlsx_INCLUDE_DIR - the QXlsx include directory
# QXlsx_LIBRARY - Link these to use QXlsx
# @EXPORT_NAME@_INCLUDE_DIR - the QXlsx include directory
# @EXPORT_NAME@_LIBRARY_DIR - the QXlsx library directory
# @EXPORT_NAME@_LIBRARIES - Link these to use QXlsx

SET(prefix "@CMAKE_INSTALL_PREFIX@")
SET(exec_prefix "@CMAKE_INSTALL_PREFIX@")
SET(QXlsx_FOUND "TRUE")
@PACKAGE_INIT@

set_and_check(@EXPORT_NAME@_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(@EXPORT_NAME@_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

set(@EXPORT_NAME@_LIBRARIES "@EXPORT_NAME@")

check_required_components(@EXPORT_NAME@)
2 changes: 1 addition & 1 deletion QXlsx/source/xlsxdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ std::string copyTag(const std::string &sFrom, const std::string &sTo, const std:

if (!sFromData.empty()) { // tag found in 'from'?
// search all occurrences of tag in 'sOut' and delete them
int firstPosTag = -1;
size_t firstPosTag = -1;
while (true) {
std::size_t startPos = sOut.find(tagToFindStart);
if (startPos != std::string::npos) {
Expand Down