CMake: Enable CMAKE_OPTIMIZE_DEPENDENCIES by default

Ever since #107858 landed builds of a single library from a clean state
were significant heavier than they used to the since the full dependency
chain is being build. While this is desired behavior since some projects
emit artefacts (like bf_dna's dna_type_offsets.h) for others given we
are building static libraries that don't actually get linked until the
very end this is unneeded. CMake offers a flag here to optimize this
called CMAKE_OPTIMIZE_DEPENDENCIES. See the CMake docs for details
what this exactly does.

This diff changes the default for CMAKE_OPTIMIZE_DEPENDENCIES from
Off to On for all CMake versions that support it. If people desire to
do so, this flag can still be changed though CMakeCache.txt

Pull Request: https://projects.blender.org/blender/blender/pulls/109672
This commit is contained in:
Ray Molenkamp 2023-07-04 17:38:02 +02:00 committed by Ray molenkamp
parent b441a28ea0
commit 39b3a95efb

@ -170,6 +170,13 @@ if(WIN32)
)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19")
# This changes the default value from Off to On, but will still allow people to manually change
# this setting through their CMakeCache.txt if they desire to do so.
set(CMAKE_OPTIMIZE_DEPENDENCIES ON CACHE INTERNAL "")
endif()
# -----------------------------------------------------------------------------
# Declare Options