Skip to content

Commit

Permalink
CompileGResources: Respect SOURCE_DIR option for input resource files
Browse files Browse the repository at this point in the history
It is actually respected and passed down to the glic-compile-resources
tool, however, the generated Makefiles won't find those resource files
because they are always assumed to be at CMAKE_CURRENT_SOURCE_DIR.

Fixes #20
  • Loading branch information
daleclack authored and Makman2 committed Nov 1, 2021
1 parent c39fdec commit dbb4901
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions macros/CompileGResources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit dbb4901

Please sign in to comment.