CMake: Work around CMake issue 20206

This commit is contained in:
Sam Edwards 2020-01-10 14:17:59 -07:00
parent a1d43f7b88
commit 28b85d2f58
2 changed files with 16 additions and 0 deletions

View File

@ -37,6 +37,17 @@ set(COMPOSITE_GENERATOR "${CMAKE_SOURCE_DIR}/cmake/scripts/MakeComposite.cmake")
function(composite_sources target sources_var)
if(NOT CMAKE_VERSION VERSION_LESS "3.16")
# CMake 3.16+ implements CMAKE_UNITY_BUILD* natively; no need to continue!
# Actually - <=3.16.2 has difficulty with multi-language support, so only
# allow .cxx in. Hopefully this can be removed soon.
foreach(_source ${${sources_var}})
get_filename_component(_source_ext "${_source}" EXT)
if(NOT _source_ext STREQUAL ".cxx")
set_source_files_properties(${_source} PROPERTIES
SKIP_UNITY_BUILD_INCLUSION YES)
endif()
endforeach(_source)
return()
endif()

View File

@ -8,6 +8,11 @@ set(P3SHOWBASE_SOURCES
if(APPLE)
list(APPEND P3SHOWBASE_SOURCES showBase_assist.mm)
# Bug in CMake 3.16.2: it tries to put .mm with the .cxx
set_source_files_properties(showBase_assist.mm PROPERTIES
SKIP_UNITY_BUILD_INCLUSION YES)
endif()
add_component_library(p3showbase NOINIT SYMBOL BUILDING_DIRECT_SHOWBASE