diff --git a/macros/CompileGResources.cmake b/macros/CompileGResources.cmake index 6c54dc7..b5c5dff 100644 --- a/macros/CompileGResources.cmake +++ b/macros/CompileGResources.cmake @@ -135,13 +135,18 @@ function(COMPILE_GRESOURCES output xml_out) message(FATAL_ERROR ${CG_ERRMSG}) endif() + # If source directory is not set, default to working directory. + if (NOT CG_ARG_SOURCE_DIR) + set(CG_ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + endif() + # Extract all dependencies for targets from resource list. foreach(res ${CG_ARG_RESOURCES}) if (NOT(("${res}" STREQUAL "COMPRESS") OR ("${res}" STREQUAL "STRIPBLANKS") OR ("${res}" STREQUAL "TOPIXDATA"))) - list(APPEND CG_RESOURCES_DEPENDENCIES "${res}") + list(APPEND CG_RESOURCES_DEPENDENCIES "${CG_ARG_SOURCE_DIR}/${res}") endif() endforeach() @@ -202,11 +207,6 @@ function(COMPILE_GRESOURCES output xml_out) set(CG_ARG_TARGET "${CG_ARG_TARGET}.${CG_TARGET_FILE_ENDING}") endif() - # Create source directory automatically if not set. - if (NOT CG_ARG_SOURCE_DIR) - set(CG_ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - endif() - # Add compilation target for resources. add_custom_command(OUTPUT ${CG_ARG_TARGET} COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE}