diff options
author | Brad King <brad.king@kitware.com> | 2016-02-24 14:39:25 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-02-24 14:39:25 (GMT) |
commit | 2039bf40e47c795ab1e57821b44b8a15c5c80775 (patch) | |
tree | d5a8f11ebf3167de36ad28b732013448ca2ef90e /Modules | |
parent | 99895f85b3d9ee9c3a016a93c6603b6e89e7c121 (diff) | |
parent | 84ccd4f7461ac2c2ee471a4d77f3e184c676c276 (diff) | |
download | CMake-2039bf40e47c795ab1e57821b44b8a15c5c80775.zip CMake-2039bf40e47c795ab1e57821b44b8a15c5c80775.tar.gz CMake-2039bf40e47c795ab1e57821b44b8a15c5c80775.tar.bz2 |
Merge topic 'CodeBlocksParallelFlag'
84ccd4f7 CodeBlocks: generate parallel project files (make -j)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeFindCodeBlocks.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake index f8d8d59..bf85ea0 100644 --- a/Modules/CMakeFindCodeBlocks.cmake +++ b/Modules/CMakeFindCodeBlocks.cmake @@ -23,3 +23,18 @@ endif() # Determine builtin macros and include dirs: include(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake) + +# Try to find out how many CPUs we have and set the -j argument for make accordingly +set(_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS "") + +include(ProcessorCount) +processorcount(_CMAKE_CODEBLOCKS_PROCESSOR_COUNT) + +# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name +# (we may also get here in the future e.g. for ninja) +if("${_CMAKE_CODEBLOCKS_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make) + set(_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS "-j${_CMAKE_CODEBLOCKS_PROCESSOR_COUNT}") +endif() + +# This variable is used by the CodeBlocks generator and appended to the make invocation commands. +set(CMAKE_CODEBLOCKS_MAKE_ARGUMENTS "${_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when CodeBlocks invokes make. Enter e.g. -j<some_number> to get parallel builds") |