Issue #25: Correct version, install MSVC redistributable package

This commit is contained in:
Jakub Melka 2022-08-27 18:15:16 +02:00
parent 6bef6b9f05
commit 22b03ed01b
2 changed files with 16 additions and 5 deletions

View File

@ -22,7 +22,9 @@ set(PDF4QT_VERSION 1.2.2)
project(PDF4QT VERSION ${PDF4QT_VERSION} LANGUAGES CXX) project(PDF4QT VERSION ${PDF4QT_VERSION} LANGUAGES CXX)
option(PDF4QT_INSTALL_DEPENDENCIES "Install dependencies" ON) option(PDF4QT_INSTALL_DEPENDENCIES "Install dependencies" ON)
option(PDF4QT_INSTALL_QT_DEPENDENCIES "Instal Qt dependencies" ON) option(PDF4QT_INSTALL_QT_DEPENDENCIES "Install Qt dependencies" ON)
add_compile_definitions(PDF4QT_PROJECT_VERSION="${PDF4QT_VERSION}")
if(WIN32 AND MSVC) if(WIN32 AND MSVC)
option(PDF4QT_INSTALL_MSVC_REDISTRIBUTABLE "Install MSVC redistributable package" ON) option(PDF4QT_INSTALL_MSVC_REDISTRIBUTABLE "Install MSVC redistributable package" ON)
@ -135,6 +137,14 @@ if(PDF4QT_INSTALL_DEPENDENCIES)
endif() endif()
if(WIN32 AND MSVC AND PDF4QT_INSTALL_MSVC_REDISTRIBUTABLE) if(WIN32 AND MSVC AND PDF4QT_INSTALL_MSVC_REDISTRIBUTABLE)
get_filename_component(MSVC_REDISTRIBUTABLES_PATH $ENV{VCToolsRedistDir}/$ENV{VSCMD_ARG_TGT_ARCH}/Microsoft.VC${MSVC_TOOLSET_VERSION}.CRT/ ABSOLUTE)
message(STATUS "MSVC Redistributable Package Path = ${MSVC_REDISTRIBUTABLES_PATH}")
install(DIRECTORY ${MSVC_REDISTRIBUTABLES_PATH}/
RUNTIME DESTINATION bin/
FILES_MATCHING
PATTERN "*.dll"
)
endif() endif()
endif() endif()

View File

@ -24,12 +24,13 @@
namespace pdf namespace pdf
{ {
#define PDF4QT_STRINGIFY(x) PDF4QT_STRINGIFY_IMPL(x) #ifndef PDF4QT_PROJECT_VERSION
#define PDF4QT_STRINGIFY_IMPL(x) #x #define PDF4QT_PROJECT_VERSION "UNKNOWN"
#endif
// Name of the library, together with version // Name of the library, together with version
static constexpr const char* PDF_LIBRARY_NAME = "PDF4QT " PDF4QT_STRINGIFY(PDF4QT_PROJECT_VERSION); static constexpr const char* PDF_LIBRARY_NAME = "PDF4QT " PDF4QT_PROJECT_VERSION;
static constexpr const char* PDF_LIBRARY_VERSION = PDF4QT_STRINGIFY(PDF4QT_PROJECT_VERSION); static constexpr const char* PDF_LIBRARY_VERSION = PDF4QT_PROJECT_VERSION;
// Structure file constants // Structure file constants
static constexpr const char* PDF_END_OF_FILE_MARK = "%%EOF"; static constexpr const char* PDF_END_OF_FILE_MARK = "%%EOF";