How to pass compiler flags to build a project on the command line in Windows?

Etna - 0 Reputation points
2023-11-14T09:06:57.3766667+00:00

I'm new to the MS build system and am attempting to build some open-source code as a learning process, starting with upstream Perl.

Following the instructions in the Makefile results in a perl build that has a dependency on vcruntime140.dll. I want to statically link this library to the executables so that I can transfer the completed build to another computer that doesn't have the VC runtime installed.

Since it's not possible to build this in the IDE due to a lack of a sln file, I need to know how to add a /MT flag to the compiler via the command line. Will "set CL=/MP /MT" suffice? In Linux, I could influence the compiler by doing CC=<compiler> <bunch of flags> and CFLAGS=<bunch of flags>. What's the equivalent method in Windows?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,249 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.