MantisBT - CMake
View Issue Details
0013617CMakeCMakepublic2012-10-30 12:112016-06-10 14:31
BartÅ‚omiej Palmowski 
Kitware Robot 
normalfeatureN/A
closedmoved 
x86-64linuxall
CMake 2.8.9 
 
0013617: use $(MAKE) -C instead of cd <path> && /usr/bin/gmake
Hi,

in case of add_custom_target or add_custom_command if one uses ${CMAKE_MAKE_PROGRAM} like this:

[...]
COMMAND ${CMAKE_MAKE_PROGRAM}
[...]

Unix make generator will translate it as:
cd <path> && /usr/bin/gmake

which kills jobserver, I know that cmake code is agnostic of what is generated, but it would be nice if actually $(MAKE) -C <path> was generated.
[palmowsk@suzuki bug]$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.6)

project(feature_request)

add_custom_target(run_make
    COMMAND ${CMAKE_MAKE_PROGRAM} -f ${PROJECT_SOURCE_DIR}/test.mk
)
[palmowsk@suzuki bug]$ cat test.mk
.PHONY: all

all: a b c

.DEFAULT:
        echo $@
        sleep 5
[palmowsk@suzuki bug]$ mkdir build
[palmowsk@suzuki bug]$ cd build/
[palmowsk@suzuki build]$ cmake ..
-- The C compiler identification is GNU 4.4.6
-- The CXX compiler identification is GNU 4.4.6
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/palmowsk/bug/build
[palmowsk@suzuki build]$ make run_make
Scanning dependencies of target run_make
a
b
c
Built target run_make
[palmowsk@suzuki build]$ make run_make -j3 # jobserver isn't going to work
gmake[4]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
a
b
c
Built target run_make
[palmowsk@suzuki build]$
cmake version 2.8.8
No tags attached.
Issue History
2012-10-30 12:11Bartłomiej PalmowskiNew Issue
2016-06-10 14:28Kitware RobotNote Added: 0042138
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042138)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.