From 7b8477ad43b270d397dd906f21b481557ae5f264 Mon Sep 17 00:00:00 2001 From: Nick Logozzo Date: Sat, 6 Jan 2024 16:26:22 -0500 Subject: [PATCH] CMake - Better Windows Build --- CMakeLists.txt | 13 +++++++------ include/notifications/notifyicon.h | 1 - include/taskbar/taskbaritem.h | 2 -- src/keyring/systemcredentials.cpp | 1 - src/taskbar/taskbaritem.cpp | 1 - 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3fb981..7f942c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ if(DEFINED ENV{VCPKG_ROOT}) endif() if(WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - set(BUILD_SHARED_LIBS ON) endif() if (POLICY CMP0141) cmake_policy(SET CMP0141 NEW) @@ -71,12 +70,14 @@ endif() #libaura Packages find_package(Boost REQUIRED COMPONENTS locale) find_package(CURL REQUIRED) -find_package(jsoncpp REQUIRED) +find_package(jsoncpp CONFIG REQUIRED) find_package(Intl REQUIRED) find_package(OpenSSL REQUIRED) -find_package(unofficial-maddy REQUIRED) +find_package(unofficial-maddy CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PUBLIC Boost::boost Boost::locale CURL::libcurl JsonCpp::JsonCpp Intl::Intl OpenSSL::SSL OpenSSL::Crypto unofficial::maddy::maddy) -if(LINUX) +if(WIN32) + target_link_libraries(${PROJECT_NAME} PUBLIC Advapi32 Dwmapi Gdiplus Shell32) +elseif(LINUX) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) find_package(PkgConfig REQUIRED) @@ -120,6 +121,6 @@ if (NOT BUILD_TESTING STREQUAL OFF) "tests/updatertests.cpp" "tests/versiontests.cpp" "tests/webtests.cpp") - find_package(GTest REQUIRED) - target_link_libraries(${PROJECT_NAME}_test PRIVATE GTest::gtest_main GTest::gmock_main ${PROJECT_NAME}) + find_package(GTest CONFIG REQUIRED) + target_link_libraries(${PROJECT_NAME}_test PRIVATE GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main ${PROJECT_NAME}) endif() \ No newline at end of file diff --git a/include/notifications/notifyicon.h b/include/notifications/notifyicon.h index c504e56..c435c50 100644 --- a/include/notifications/notifyicon.h +++ b/include/notifications/notifyicon.h @@ -12,7 +12,6 @@ #include #include "notifyiconmenu.h" #include "shellnotificationsenteventargs.h" -#pragma comment(lib,"shell32.lib") namespace Nickvision::Aura::Notifications { diff --git a/include/taskbar/taskbaritem.h b/include/taskbar/taskbaritem.h index 9fc508f..b4bc5fe 100644 --- a/include/taskbar/taskbaritem.h +++ b/include/taskbar/taskbaritem.h @@ -10,8 +10,6 @@ #include #include #include -#pragma comment(lib,"shell32.lib") -#pragma comment(lib,"gdiplus.lib") #elif defined(__linux__) #include #endif diff --git a/src/keyring/systemcredentials.cpp b/src/keyring/systemcredentials.cpp index b27d5f3..0637b65 100644 --- a/src/keyring/systemcredentials.cpp +++ b/src/keyring/systemcredentials.cpp @@ -4,7 +4,6 @@ #ifdef _WIN32 #include #include -#pragma comment(lib,"advapi32.lib") #elif defined(__linux__) #include #endif diff --git a/src/taskbar/taskbaritem.cpp b/src/taskbar/taskbaritem.cpp index a0be06a..21e27cb 100644 --- a/src/taskbar/taskbaritem.cpp +++ b/src/taskbar/taskbaritem.cpp @@ -3,7 +3,6 @@ #include #ifdef _WIN32 #include -#pragma comment(lib,"dwmapi.lib") using namespace Gdiplus; #elif defined(__linux__) #include