added support version

This commit is contained in:
Andrei Yankovich 2022-01-17 18:59:54 +03:00
parent ed955426bc
commit 1c81a21338
5 changed files with 16 additions and 1 deletions

View File

@ -29,7 +29,7 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
include(submodules/CMake/QuasarApp.cmake)
updateGitVars()
set(DoctorPill_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")
set(DOCTOR_PILL_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")
option(DOCTOR_PILL_GUI "Enable gui qml model for build" ON)
option(DOCTOR_PILL_TESTS "Enable tests of this library" ON)

View File

@ -30,6 +30,8 @@ endif()
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private")
set(global_file "${CMAKE_CURRENT_SOURCE_DIR}/doctorpill_global.h")
configure_file("${global_file}.in" ${global_file} @ONLY)
add_library(${PROJECT_NAME} ${SOURCE_CPP} ${SOURCE_QRC} ${SOURCE_CPP_GUI})
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core )

View File

@ -27,6 +27,11 @@ bool init(QQmlApplicationEngine *engine) {
return true;
}
QString version() {
return DOCTOR_PILL_VERSION;
}
#else
bool init() {
return true;

View File

@ -45,4 +45,10 @@ namespace DP {
*/
bool DOCTOR_PILL_EXPORT init();
#endif
/**
* @brief version This method return string value of lib version
* @return string value of lib version.
*/
QString version();
}

View File

@ -16,5 +16,7 @@
# define DOCTOR_PILL_EXPORT Q_DECL_IMPORT
#endif
#define DOCTOR_PILL_VERSION "@DOCTOR_PILL_VERSION@"
#endif //DoctorPill_GLOBAL_H