Skip to content

enable unity builds - #9

Open
vrcomputing wants to merge 4 commits into
masterfrom
cmakeunitybuild
Open

enable unity builds#9
vrcomputing wants to merge 4 commits into
masterfrom
cmakeunitybuild

Conversation

@vrcomputing

@vrcomputing vrcomputing commented Nov 24, 2024

Copy link
Copy Markdown
Owner

What

Enable CMAKE_UNITY_BUILD accelerating total build time from 50s to 36s. 😮

This enables unity builds globally ( ⚠️ not recommended )

set(CMAKE_UNITY_BUILD ON)

This enables unity builds on a specific target

set_target_properties(${target} PROPERTIES UNITY_BUILD ON)

This excludes generated moc_* files from it

if(BUILD_UNITY)
    file(GLOB_RECURSE MOC_FILES
        ${CMAKE_CURRENT_BINARY_DIR}/moc_*.cpp
    )

    set_source_files_properties(${MOC_FILES} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant