From de10fe34ab59b76951ad4faa463eedd9467e5bcb Mon Sep 17 00:00:00 2001 From: Sascha Kratky Date: Thu, 8 Dec 2016 12:17:26 +0100 Subject: [PATCH] fix automoc target dependency for Visual Studio generators --- CMake/cotire.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMake/cotire.cmake b/CMake/cotire.cmake index 7c1c8c1..9ac8cee 100644 --- a/CMake/cotire.cmake +++ b/CMake/cotire.cmake @@ -3000,9 +3000,16 @@ function (cotire_setup_unity_build_target _languages _configurations _target) else() add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}) endif() - if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) - # depend on the original target's implicity generated _automoc target - add_dependencies(${_unityTargetName} ${_target}_automoc) + if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # depend on original target's automoc target, if it exists + if (TARGET ${_target}_automoc) + add_dependencies(${_unityTargetName} ${_target}_automoc) + endif() + else() + if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) + # depend on the original target's implicity generated _automoc target + add_dependencies(${_unityTargetName} ${_target}_automoc) + endif() endif() # copy output location properties set (_outputDirProperties