jobserver unavailable when building external proje

2019-01-25 13:09发布

I'm trying to build some external projects with CMake on linux using ExternalProject_add. However, they aren't respecting the make -j12 command, and are giving the warning:

‘warning: jobserver unavailable: using -j1. Add `+' to parent make rule.’

This slows my build painfully. Is there some way to build external projects in parallel? Here's an example project:

include(ExternalProject)
    ExternalProject_Add(
        ${TARGET_NAME}-ext
        URL ${CMAKE_CURRENT_SOURCE_DIR}/xerces-c-${VERSION_XERCESC}.tar.gz
        DOWNLOAD_DIR ${XERCESC_DIR}
        SOURCE_DIR ${XERCESC_DIR}/src
        PATCH_COMMAND chmod guo+rw ${CMAKE_CURRENT_SOURCE_DIR} -R
        CONFIGURE_COMMAND ./configure --prefix=${XERCESC_DIR} --disable-shared -q --disable-network --enable-transcoder-gnuiconv --enable-msgloader-inmemory
        BUILD_COMMAND make --silent
        INSTALL_COMMAND make install
        BUILD_IN_SOURCE 1
    )

1条回答
Juvenile、少年°
2楼-- · 2019-01-25 13:34

In order to allow the make commands to properly propagate to their children, you need to use $(MAKE) with parenthesis (not curly-braces) instead of make as your command, i.e.

BUILD_COMMAND $(MAKE) --silent
INSTALL_COMMAND $(MAKE) install

This is supported from CMake version 2.8.4 onward.

查看更多
登录 后发表回答