ladybird/Meta/CMake/precompile-headers.cmake
Ali Mohammad Pur 468ac11f29 Meta: Add an option to precompile some very common AK headers
Until we get the goodness that C++ modules are supposed to be, let's try
to shave off some parse time using precompiled headers.
This commit only adds some very common AK headers, only to binaries,
libraries and the kernel (tests are not covered due to incompatibility
with AK/TestSuite.h).
This option is on by default, but can be disabled by passing
`-DPRECOMPILE_COMMON_HEADERS=OFF` to cmake, which will disable all
header precompilations.
This makes the build about 30 seconds faster on my machine (about 7%).
2021-04-21 14:29:46 +02:00

9 lines
405 B
CMake

function(serenity_add_precompiled_header_to_target target header)
if (PRECOMPILE_COMMON_HEADERS AND COMMAND target_precompile_headers)
target_precompile_headers(${target} PRIVATE ${header})
endif ()
endfunction()
function(serenity_add_ak_precompiled_headers_to_target target)
serenity_add_precompiled_header_to_target(${target} ${CMAKE_SOURCE_DIR}/Meta/Precompile/AK.h)
endfunction()