-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactore cmake files, adding optional demos and tests to the build
- Loading branch information
1 parent
a942060
commit 3268ae3
Showing
9 changed files
with
96 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project(SmtpMime | ||
VERSION 2.0 | ||
LANGUAGES C CXX) | ||
|
||
option(BUILD_TESTS "builds tests" ON) | ||
option(BUILD_DEMOS "builds demos" ON) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_AUTOUIC OFF) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC OFF) | ||
|
||
find_package(QT NAMES Qt6 COMPONENTS Core Network REQUIRED) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network REQUIRED) | ||
|
||
set(LIBRARY_TARGET_NAME ${PROJECT_NAME}) | ||
|
||
message(USING Qt${QT_VERSION_MAJOR}) | ||
|
||
add_subdirectory(src) | ||
|
||
if (BUILD_TESTS) | ||
add_subdirectory(test) | ||
endif() | ||
if (BUILD_DEMOS) | ||
add_subdirectory(demos) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Widgets REQUIRED) | ||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
||
add_subdirectory(demo1) | ||
add_subdirectory(demo2) | ||
add_subdirectory(demo3) | ||
add_subdirectory(demo4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_executable(demo1 demo1.cpp) | ||
|
||
target_link_libraries(demo1 PRIVATE | ||
Qt${QT_VERSION_MAJOR}::Core | ||
${LIBRARY_TARGET_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
add_executable(demo2 | ||
demo2.cpp | ||
sendemail.cpp | ||
sendemail.ui) | ||
|
||
target_link_libraries(demo2 PRIVATE | ||
Qt${QT_VERSION_MAJOR}::Core | ||
Qt${QT_VERSION_MAJOR}::Gui | ||
Qt${QT_VERSION_MAJOR}::Widgets | ||
${LIBRARY_TARGET_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_executable(demo3 demo3.cpp) | ||
|
||
target_link_libraries(demo3 PRIVATE | ||
Qt${QT_VERSION_MAJOR}::Core | ||
${LIBRARY_TARGET_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_executable(demo4 demo4.cpp) | ||
|
||
target_link_libraries(demo4 PRIVATE | ||
Qt${QT_VERSION_MAJOR}::Core | ||
${LIBRARY_TARGET_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED) | ||
|
||
add_executable(test | ||
main.cpp | ||
connectiontest.cpp) | ||
|
||
target_link_libraries(test PRIVATE | ||
Qt${QT_VERSION_MAJOR}::Core | ||
Qt${QT_VERSION_MAJOR}::Test | ||
${LIBRARY_TARGET_NAME}) |