CMake build: Gracefully handle turned off target in qtc_add_resources

Otherwise qtc_add_resources fails when turning off corresponding
BUILD_.... flags, or needs to be wrapped with "if(TARGET ...)" everywhere.

Change-Id: I34e230569ab9619b1c107404bf2fdf8e8e86bd7e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2021-05-25 14:10:10 +02:00
parent b709f3115b
commit 0b0226b112

View File

@@ -912,6 +912,10 @@ function(qtc_add_resources target resourceName)
return() return()
endif() endif()
if(NOT TARGET ${target})
return()
endif()
string(REPLACE "/" "_" resourceName ${resourceName}) string(REPLACE "/" "_" resourceName ${resourceName})
string(REPLACE "." "_" resourceName ${resourceName}) string(REPLACE "." "_" resourceName ${resourceName})