MantisBT - CMake
View Issue Details
0014548CMakeCMakepublic2013-11-06 11:052014-06-02 08:37
Steve Wolak 
Brad King 
normalminoralways
closedfixed 
WindowsWindows7
CMake 2.8.12 
CMake 3.0CMake 3.0 
0014548: Document CMAKE_MAKE_PROGRAM as preferred over CMAKE_BUILD_TOOL, not vice versa
When attempting to configure for a JOM build system, JOM should be in the path. I find this acceptable, but also wanted a way for the users of our system to be able to specify where to find the JOM executable in another way. After looking at the CMake documentation I found CMAKE_MAKE_PROGRAM, which says:

"See CMAKE_BUILD_TOOL.
This variable is around for backwards compatibility, see CMAKE_BUILD_TOOL."

I allow the user to set an environment variable that points to the JOM executable. I then use this environment variable during generation of the JOM makefiles in the following way:

cmake -DCMAKE_TOOLCHAIN_FILE=<some value> -DCMAKE_BUILD_TOOL=<User provided information> -G "NMake Makefiles JOM".

I found this did not work for the configure step as CMake would fail to compile the test programs because it couldn't locate JOM. "Interesting", I thought. The cache certainly had CMAKE_BUILD_TOOL set as I expected it to. I then noticed that CMAKE_MAKE_PROGRAM was still set to just "jom". "Ah!". I modified my CMake command to be:

cmake -DCMAKE_TOOLCHAIN_FILE=<some value> -DCMAKE_MAKE_PROGRAM=<User provided information> -DCMAKE_BUILD_TOOL=<User provided information> -G "NMake Makefiles JOM" .

And the configure step worked correctly.

I believe that CMAKE_MAKE_PROGRAM should be set to CMAKE_BUILD_TOOL in the cache, or perhaps the documentation needs to be updated to state that it's used for the JOM generator, or maybe the step that checks that the compiler works needs to be updated to use CMAKE_BUILD_TOOL instead of CMAKE_MAKE_PROGRAM when generating JOM files.
Leave JOM out of your path, but be sure to add the necessary information for Visual Studio (i.e. run vcvarsall.bat or similar script).

Attempt to run

cmake -DCMAKE_TOOLCHAIN_FILE=<some value> -DCMAKE_BUILD_TOOL=<Path to JOM, including executable> -G "NMake Makefiles JOM" .

Configure should fail. Clear the cache file then run:

cmake -DCMAKE_TOOLCHAIN_FILE=<some value> -DCMAKE_MAKE_PROGRAM=<Path to JOM, including executable> -DCMAKE_BUILD_TOOL=<Path to JOM, including executable> -G "NMake Makefiles JOM" .

Configure works
I would like to be able to pass the build tool to CMake at configure, but some clarification is needed on the correct way to do that.
No tags attached.
Issue History
2013-11-06 11:05Steve WolakNew Issue
2013-11-06 11:15Brad KingNote Added: 0034404
2013-11-19 11:09Brad KingNote Added: 0034480
2013-11-19 11:10Brad KingAssigned To => Brad King
2013-11-19 11:10Brad KingStatusnew => resolved
2013-11-19 11:10Brad KingResolutionopen => fixed
2013-11-19 11:10Brad KingFixed in Version => CMake 3.0
2013-11-19 11:10Brad KingTarget Version => CMake 3.0
2013-11-19 11:10Brad KingSummaryCMAKE_MAKE_PROGRAM, not CMAKE_BUILD_TOOL used for verification of JOM during configure step => Document CMAKE_MAKE_PROGRAM as preferred over CMAKE_BUILD_TOOL, not vice versa
2014-06-02 08:37Robert MaynardNote Added: 0036014
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0034404)
Brad King   
2013-11-06 11:15   
The documentation is clearly not representative of the current state of things:

$ git grep CMAKE_BUILD_TOOL v2.8.12 -- |wc -l
19
$ git grep CMAKE_MAKE_PROGRAM v2.8.12 -- |wc -l
116

It looks like someone tried to generalize the name from CMAKE_MAKE_PROGRAM to CMAKE_BUILD_TOOL at one point but it never stuck.
(0034480)
Brad King   
2013-11-19 11:09   
As part of a sweeping cleanup for CMAKE_MAKE_PROGRAM handling I revised the documentation to favor it over CMAKE_BUILD_TOOL:

 Prefer CMAKE_MAKE_PROGRAM over CMAKE_BUILD_TOOL
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ac75fdf [^]

See the commit message for further explanation.
(0036014)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.