diff --git a/cmake/modules/ImHexPlugin.cmake b/cmake/modules/ImHexPlugin.cmake index 2b3024c29..cebb13cd8 100644 --- a/cmake/modules/ImHexPlugin.cmake +++ b/cmake/modules/ImHexPlugin.cmake @@ -117,6 +117,10 @@ macro(add_imhex_plugin) endmacro() macro(add_romfs_resource input output) + if (NOT EXISTS ${input}) + message(WARNING "Resource file ${input} does not exist") + endif() + configure_file(${input} ${CMAKE_CURRENT_BINARY_DIR}/romfs/${output} COPYONLY) list(APPEND LIBROMFS_RESOURCE_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/romfs) diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt index ea86ca348..80c6c9405 100644 --- a/plugins/builtin/CMakeLists.txt +++ b/plugins/builtin/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.16) include(ImHexPlugin) +find_file(DEFAULT_MAGIC_FILE_PATH magic.mgc HINTS ${LIBMAGIC_INCLUDE_DIR}/../share/misc) +if (EXISTS ${DEFAULT_MAGIC_FILE_PATH}) + add_romfs_resource(${DEFAULT_MAGIC_FILE_PATH} always_auto_extract/magic/magic.mgc) +endif () + add_imhex_plugin( NAME builtin @@ -122,11 +127,6 @@ add_imhex_plugin( LLVMDemangle ) -find_file(DEFAULT_MAGIC_FILE_PATH magic.mgc HINTS ${LIBMAGIC_INCLUDE_DIR}/../share/misc) -if (DEFAULT_MAGIC_FILE_PATH) - add_romfs_resource(${DEFAULT_MAGIC_FILE_PATH} always_auto_extract/magic/magic.mgc) -endif () - if (WIN32) target_link_libraries(builtin PRIVATE setupapi) endif () \ No newline at end of file