Skip to content

Bloated build directory with CMake on macOS #351

Open
@julcst

Description

@julcst

In my CMake project I download and build glbinding as a dependency with FetchContent:

include(FetchContent)

FetchContent_Declare(
    glbinding
    #GIT_REPOSITORY https://github.com/cginternals/glbinding.git
    GIT_TAG v3.3.0
    URL https://github.com/cginternals/glbinding/archive/v3.3.0.tar.gz
    EXCLUDE_FROM_ALL
)
set(OPTION_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
set(OPTION_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)

This works but generates a huge build folder build/_deps/glbinding-build (160-200 MB in Debug mode 45 MB in Release mode)
This massive amount of data sits inside build/_deps/glbinding-build/source/glbinding/CMakeFiles/glbinding.dir/source and build/_deps/glbinding-build/source/glbinding-aux/CMakeFiles/glbinding-aux.dir/source in form of really big .o and .o.d files:
glbinding-debug-mode
Can I do anything to reduce the build size as permanently setting Release mode is not a real option?

I also tried setting

set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)

and

set(OPTION_BUILD_WITH_LTO ON CACHE BOOL "" FORCE)

but these options had no significant effect.

My compiler is Clang 15.0.0 arm64-apple-darwin23.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions