Prevent the same resource directory from being installed twice.
Using parent scope is not good enough when multiple targets referencing a same resource directory are not located inside a same parent scope. Using internal cache fixes this.
This commit is contained in:
parent
6aba66ce66
commit
35138fbc33
@ -955,10 +955,8 @@ endmacro ()
|
||||
macro (define_resource_dirs)
|
||||
check_source_files ("Could not call define_resource_dirs() macro before define_source_files() macro.")
|
||||
cmake_parse_arguments (ARG "" "HTML_SHELL" "GLOB_PATTERNS;EXCLUDE_PATTERNS;EXTRA_DIRS" ${ARGN})
|
||||
if (WEB)
|
||||
if (ARG_HTML_SHELL)
|
||||
add_html_shell (${ARG_HTML_SHELL})
|
||||
endif ()
|
||||
if (WEB AND ARG_HTML_SHELL)
|
||||
add_html_shell (${ARG_HTML_SHELL})
|
||||
endif ()
|
||||
# If not explicitly specified then use the Urho3D project structure convention
|
||||
if (NOT ARG_GLOB_PATTERNS)
|
||||
@ -1058,20 +1056,22 @@ endmacro()
|
||||
# Macro fo adding a HTML shell-file when targeting Web platform
|
||||
macro (add_html_shell)
|
||||
check_source_files ("Could not call add_html_shell() macro before define_source_files() macro.")
|
||||
if (NOT ${ARGN} STREQUAL "")
|
||||
set (HTML_SHELL ${ARGN})
|
||||
else ()
|
||||
# Create Urho3D custom HTML shell that also embeds our own project logo
|
||||
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Source/shell.html)
|
||||
file (READ ${EMSCRIPTEN_ROOT_PATH}/src/shell.html HTML_SHELL)
|
||||
string (REPLACE "<!doctype html>" "<!-- This is a generated file. DO NOT EDIT!-->\n\n<!doctype html>" HTML_SHELL "${HTML_SHELL}") # Stringify to preserve semicolons
|
||||
string (REPLACE "<body>" "<body>\n\n<a href=\"https://urho3d.github.io\" title=\"Urho3D Homepage\"><img src=\"https://urho3d.github.io/assets/images/logo.png\" alt=\"link to https://urho3d.github.io\" height=\"80\" width=\"160\" /></a>\n" HTML_SHELL "${HTML_SHELL}")
|
||||
file (WRITE ${CMAKE_BINARY_DIR}/Source/shell.html "${HTML_SHELL}")
|
||||
if (EMSCRIPTEN)
|
||||
if (NOT ${ARGN} STREQUAL "")
|
||||
set (HTML_SHELL ${ARGN})
|
||||
else ()
|
||||
# Create Urho3D custom HTML shell that also embeds our own project logo
|
||||
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Source/shell.html)
|
||||
file (READ ${EMSCRIPTEN_ROOT_PATH}/src/shell.html HTML_SHELL)
|
||||
string (REPLACE "<!doctype html>" "<!-- This is a generated file. DO NOT EDIT!-->\n\n<!doctype html>" HTML_SHELL "${HTML_SHELL}") # Stringify to preserve semicolons
|
||||
string (REPLACE "<body>" "<body>\n\n<a href=\"https://urho3d.github.io\" title=\"Urho3D Homepage\"><img src=\"https://urho3d.github.io/assets/images/logo.png\" alt=\"link to https://urho3d.github.io\" height=\"80\" width=\"160\" /></a>\n" HTML_SHELL "${HTML_SHELL}")
|
||||
file (WRITE ${CMAKE_BINARY_DIR}/Source/shell.html "${HTML_SHELL}")
|
||||
endif ()
|
||||
set (HTML_SHELL ${CMAKE_BINARY_DIR}/Source/shell.html)
|
||||
endif ()
|
||||
set (HTML_SHELL ${CMAKE_BINARY_DIR}/Source/shell.html)
|
||||
list (APPEND SOURCE_FILES ${HTML_SHELL})
|
||||
set_source_files_properties (${HTML_SHELL} PROPERTIES EMCC_OPTION shell-file)
|
||||
endif ()
|
||||
list (APPEND SOURCE_FILES ${HTML_SHELL})
|
||||
set_source_files_properties (${HTML_SHELL} PROPERTIES EMCC_OPTION shell-file)
|
||||
endmacro ()
|
||||
|
||||
include (GenerateExportHeader)
|
||||
@ -1646,7 +1646,8 @@ macro (setup_main_executable)
|
||||
install (DIRECTORY ${DIR} DESTINATION ${DEST_SHARE_DIR}/Resources)
|
||||
list (APPEND INSTALLED_RESOURCE_DIRS ${DIR})
|
||||
endif ()
|
||||
set (INSTALLED_RESOURCE_DIRS ${INSTALLED_RESOURCE_DIRS} PARENT_SCOPE)
|
||||
# This cache variable is used to keep track of whether a resource directory has been instructed to be installed by CMake or not
|
||||
set (INSTALLED_RESOURCE_DIRS ${INSTALLED_RESOURCE_DIRS} CACHE INTERNAL "Installed resource dirs")
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
@ -1658,6 +1659,9 @@ macro (setup_main_executable)
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
# This cache variable is used to keep track of whether a resource directory has been instructed to be installed by CMake or not
|
||||
unset (INSTALLED_RESOURCE_DIRS CACHE)
|
||||
|
||||
# Macro for setting up dependency lib for compilation and linking of a target (to be used internally)
|
||||
macro (_setup_target)
|
||||
# Include directories
|
||||
|
Loading…
Reference in New Issue
Block a user