Protect #pragma comment(lib, "foo") with _WIN32 checks (#6867)

lld on Linux can now process #pragma comment(lib, "foo") macros which
results in build failures on Linux when lld is used. Fix this by
protecting these macros with _WIN32 checks.
This commit is contained in:
İsmail Dönmez 2019-06-13 01:30:03 +02:00 committed by Robert Schumacher
parent 70149722d7
commit 8c49e565c0
7 changed files with 15 additions and 1 deletions

View File

@ -1,7 +1,9 @@
#include "tests.pch.h" #include "tests.pch.h"
#if defined(_WIN32)
#pragma comment(lib, "version") #pragma comment(lib, "version")
#pragma comment(lib, "winhttp") #pragma comment(lib, "winhttp")
#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
@ -61,4 +63,4 @@ namespace UnitTest1
Assert::AreEqual(size_t{0}, v.command_arguments.size()); Assert::AreEqual(size_t{0}, v.command_arguments.size());
} }
}; };
} }

View File

@ -1,7 +1,9 @@
#include "tests.pch.h" #include "tests.pch.h"
#if defined(_WIN32)
#pragma comment(lib, "version") #pragma comment(lib, "version")
#pragma comment(lib, "winhttp") #pragma comment(lib, "winhttp")
#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;

View File

@ -2,8 +2,10 @@
#include <tests.utils.h> #include <tests.utils.h>
#if defined(_WIN32)
#pragma comment(lib, "version") #pragma comment(lib, "version")
#pragma comment(lib, "winhttp") #pragma comment(lib, "winhttp")
#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;

View File

@ -1,7 +1,9 @@
#include "tests.pch.h" #include "tests.pch.h"
#if defined(_WIN32)
#pragma comment(lib, "version") #pragma comment(lib, "version")
#pragma comment(lib, "winhttp") #pragma comment(lib, "winhttp")
#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;

View File

@ -40,8 +40,10 @@
#include <memory> #include <memory>
#include <random> #include <random>
#if defined(_WIN32)
#pragma comment(lib, "ole32") #pragma comment(lib, "ole32")
#pragma comment(lib, "shell32") #pragma comment(lib, "shell32")
#endif
using namespace vcpkg; using namespace vcpkg;

View File

@ -16,7 +16,9 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
#if defined(_WIN32)
#pragma comment(lib, "Advapi32") #pragma comment(lib, "Advapi32")
#endif
using namespace vcpkg::System; using namespace vcpkg::System;

View File

@ -9,8 +9,10 @@
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#if defined(_WIN32)
#pragma comment(lib, "version") #pragma comment(lib, "version")
#pragma comment(lib, "winhttp") #pragma comment(lib, "winhttp")
#endif
namespace vcpkg::Metrics namespace vcpkg::Metrics
{ {