Skip to content

Commit f0d3e0a

Browse files
committed
Let _NBL_JOBS_AMOUNT_ be controlled via ENV variables, do not force store the result as cache variable
1 parent 4587954 commit f0d3e0a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,15 @@ endif()
110110
option(_NBL_MEMORY_CONSUMPTION_CHECK_SKIP_ "Turn it ON to bypass memory consumption test given _NBL_JOBS_AMOUNT_. Be aware you are doing it on your own risk of potential build failures!" OFF)
111111

112112
include(ProcessorCount)
113+
113114
if(NOT DEFINED _NBL_JOBS_AMOUNT_)
114-
ProcessorCount(_NBL_JOBS_AMOUNT_)
115-
if(_NBL_JOBS_AMOUNT_ EQUAL 0)
116-
set(_NBL_JOBS_AMOUNT_ 1)
115+
if(NOT "$ENV{_NBL_JOBS_AMOUNT_}" STREQUAL "")
116+
set(_NBL_JOBS_AMOUNT_ "$ENV{_NBL_JOBS_AMOUNT_}")
117+
else()
118+
ProcessorCount(_NBL_JOBS_AMOUNT_)
119+
if(_NBL_JOBS_AMOUNT_ EQUAL 0)
120+
set(_NBL_JOBS_AMOUNT_ 1)
121+
endif()
117122
endif()
118123
endif()
119124

@@ -129,7 +134,7 @@ if(NBL_CI_MODE)
129134
endif()
130135
endif()
131136

132-
set(_NBL_JOBS_AMOUNT_ "${_NBL_JOBS_AMOUNT_}" CACHE STRING "Max jobs amount for the build to be invoked" FORCE)
137+
message(STATUS "_NBL_JOBS_AMOUNT_: \"${_NBL_JOBS_AMOUNT_}\"")
133138

134139
math(EXPR _NBL_DEBUG_MEMORY_CONSUPTION_WITH_ALL_JOBS_ "${_NBL_JOBS_AMOUNT_}*2*1024") # MB
135140
math(EXPR _NBL_CURRENTLY_USED_PHYSICAL_MEMORY_ "${_NBL_TOTAL_PHYSICAL_MEMORY_}-${_NBL_AVAILABLE_PHYSICAL_MEMORY_}") # MB

0 commit comments

Comments
 (0)