What is the -D define to tell CMake where to find

2019-09-15 10:08发布

问题:

I have Visual C++ Build Tools 2015 | Standalone compiler, libraries and scripts installed on a low-end netbook. It's necessary, because the machine has a small eMMC soldered to the board with no real space available.

nmake is installed at %PROGRAM FILES%\Microsoft Visual Studio 14.0\VC\bin. However, CMake cannot find it when attempting to generate the Makefile. I'd like to use a -D to tell CMake what the makefile program is, but I am having trouble locating the list of -D defines for CMake.

For completeness, I'm trying to avoid other Microsoft tools. I have LLVM build tools at C:\LLVM\bin, so I'm setting CMAKE_C_COMPILER and CMAKE_CXX_COMPILER. But I needed nmake, because I can't find a stand-alone Make program for Windows already built.

What is the -D define to specify nmake for CMake?

回答1:

The variable you are looking for is CMAKE_MAKE_PROGRAM.

If you try to set this variable plus CMAKE_C_COMPILER, CMAKE_LINKER_EXE, etc., this will still fail, because cl.exe and link.exe need some environment variables to be set. Those can be set by using a "Visual Studio * Command Prompt" (this uses vcvars.bat from the Visual Studio install directory).

To use Clang you can install a Clang toolset from http://llvm.org/builds/. Then you can specify CMAKE_GENERATOR_TOOLSET in a toolchain file.

Let me know how this works out for you.



回答2:

CMAKE_MAKE_PROGRAM. See the documentation: