问题
I try to use gmake instead of make as the build command. So I modify the CMakeList.txt as following:
......
set(CMAKE_MAKE_PROGRAM /usr/local/bin/gmake)
......
While in CMakeCache.txt, CMAKE_MAKE_PROGRAM is still /usr/bin/make:
//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make
How to make "CMAKE_MAKE_PROGRAM" variable take effect?
回答1:
You have two options:
1: Set the make command when you call CMake: cmake -DCMAKE_MAKE_PROGRAM=gmake <the rest of your arguments>
2: Do as @arrowd hinted in the comments, but use the correct syntax: set(CMAKE_MAKE_PROGRAM gmake CACHE FILEPATH "" FORCE) or set(CMAKE_MAKE_PROGRAM gmake CACHE INTERNAL ""). The latter will hide the setting from cmake-gui.
Both of these assume that gmake is in your PATH, othwerwise you must specify a full path to gmake.
来源:https://stackoverflow.com/questions/49103936/why-doesnt-cmake-make-program-variable-take-effect