Skip to content

Commit 6fec908

Browse files
committed
parallel compilation using 8 threads
1 parent 84b9430 commit 6fec908

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ project(${PROJECT_NAME})
1010

1111
################################################################################
1212

13-
set (CMAKE_CXX_STANDARD 11)
13+
# specify the C++ standard
14+
set(CMAKE_CXX_STANDARD 11)
15+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
16+
message(STATUS "Using C++11")
17+
18+
if(MSVC)
19+
# The /MP flag is available and works as intended with the MSVC compiler
20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
21+
elseif(CMAKE_BUILD_PARALLEL_LEVEL)
22+
# Use build system parallelism (e.g., `make -j` or `ninja`)
23+
set(CMAKE_BUILD_PARALLEL_LEVEL 8) # Example: Use 8 threads
24+
endif()
1425

1526
################################################################################
1627

0 commit comments

Comments
 (0)