From 95c8758d26ffe38c33b3cd2c54b44b0fe6b1016f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Del=20Romano?= Date: Mon, 9 Sep 2024 11:08:35 +0200 Subject: [PATCH] Update CMakeLists.txt Solved some little portability issues across the various Operative System. - Qt itself requires at least CMake version 3.16 - set the version - use of the convenient "qt_add_library" - it's a library, specifying RUNTIME DESTINATION was misplacing the lib. --- src/CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eedb5a6..68ccda6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.16) -project(SmtpMime VERSION 0.1 LANGUAGES CXX) +project(SmtpMime VERSION 2.0 LANGUAGES C CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) @@ -14,9 +14,9 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED) add_compile_options(-DSMTP_MIME_LIBRARY) -message(USING QT${QT_VERSION_MAJOR}) +message(USING Qt${QT_VERSION_MAJOR}) -add_library(${PROJECT_NAME} SHARED +qt_add_library(${PROJECT_NAME} SHARED emailaddress.cpp mimeattachment.cpp mimebytearrayattachment.cpp @@ -98,12 +98,14 @@ set(public_headers mimebytearrayattachment.h ) # note that ${public_headers} has to be in quotes -set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION}) -set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${public_headers}") +set_target_properties(${PROJECT_NAME} PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + PUBLIC_HEADER "${public_headers}" +) include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/smtpmime )