From cf9fc5e22fa51e5b3a8182e7ef408cd77064a664 Mon Sep 17 00:00:00 2001 From: c8ef Date: Wed, 25 Sep 2024 04:30:31 +0800 Subject: [PATCH] [CMake] enable CMP0147 policy if available (#109150) Closes #38383. This enables parallel custom build commands, which improve compilation time on Windows with Visual Studio. --- cmake/Modules/CMakePolicy.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake index b6962668cb09a..665af01d43bd2 100644 --- a/cmake/Modules/CMakePolicy.cmake +++ b/cmake/Modules/CMakePolicy.cmake @@ -29,3 +29,9 @@ endif() if(POLICY CMP0144) cmake_policy(SET CMP0144 NEW) endif() + +# CMP0147: Visual Studio Generators build custom commands in parallel. +# New in CMake 3.27: https://cmake.org/cmake/help/latest/policy/CMP0147.html +if(POLICY CMP0147) + cmake_policy(SET CMP0147 NEW) +endif()