Skip to content

Commit bf6da9a

Browse files
dextercdLarhzu
authored andcommitted
CMake: Disable unity builds project-wide
liblzma and xz can't be compiled as a unity/jumbo build because of redeclarations and type name reuse. The CMake documentation recommends setting UNITY_BUILD to false in this case. This is especially important if we're compiled as a subproject and the consumer wants to use CMAKE_UNITY_BUILD=ON for the rest of their code base. Closes: #158
1 parent f8c328e commit bf6da9a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ set(CMAKE_C_STANDARD 11)
161161
# On Apple OSes, don't build executables as bundles:
162162
set(CMAKE_MACOSX_BUNDLE OFF)
163163

164+
# The targets defined here don't support compiling as a unity build. Encoder
165+
# and decoder source files define different types with the same name, and some
166+
# internal header files don't have header guards leading to redeclaration
167+
# errors.
168+
set(CMAKE_UNITY_BUILD OFF)
169+
164170
# Set CMAKE_INSTALL_LIBDIR and friends. This needs to be done before
165171
# the LOCALEDIR_DEFINITION workaround below.
166172
include(GNUInstallDirs)

0 commit comments

Comments
 (0)