Skip to content

Commit 653099d

Browse files
committed
parallel compilation
1 parent 9ca27a0 commit 653099d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

code/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ set(CMAKE_CXX_STANDARD 11)
2121
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2222
message("-- Setting C++11")
2323

24+
if(MSVC)
25+
# The /MP flag is available and works as intended with the MSVC compiler
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
27+
elseif(CMAKE_BUILD_PARALLEL_LEVEL)
28+
# Use build system parallelism (e.g., `make -j` or `ninja`)
29+
set(CMAKE_BUILD_PARALLEL_LEVEL 8) # Example: Use 8 threads
30+
endif()
31+
2432
################################################################################
2533

2634
# Detects whether this is a top-level project

0 commit comments

Comments
 (0)