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
)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With