From 7215dd400c92a0a7009682d47c04eb3ec364c34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aras=20Pranckevi=C4=8Dius?= Date: Sun, 17 Nov 2024 20:49:37 +0200 Subject: [PATCH] Build: compile source files in parallel under MSVC When using cmake with Visual Studio project files (default on Windows), add MSVC compile flag that enables using more than 1 CPU core during the build (i.e. compile source files in parallel). --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65570b445..ee69fe1d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,6 +166,10 @@ if(CMAKE_COMPILER_IS_GNUCC) set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$:-ffast-math>") set(OPENJP2_COMPILE_OPTIONS ${OPENJP2_COMPILE_OPTIONS} "$<$:-ffast-math>" -Wall -Wextra -Wconversion -Wunused-parameter -Wdeclaration-after-statement -Werror=declaration-after-statement -Wstrict-prototypes -Werror=strict-prototypes -Wmissing-prototypes -Werror=missing-prototypes) endif() +if(MSVC) + # Parallel source file compilation in MSVC + set(OPENJP2_COMPILE_OPTIONS ${OPENJP2_COMPILE_OPTIONS} "/MP") +endif() #----------------------------------------------------------------------------- # opj_config.h generation (1/2)