LYN-4780 CMake generation fails on a prebuilt (SDK) engine (#1541)
* fix for some install generation issues around ly_enable_gems * setting the right SettingsRegistry path for imported targets * missing "include" in the exported target * Fixed issue with the GEM_FILE argument being specified in replicated ly_enable_gems call If the original call to `ly_enable_gems` supplied an argument for GEM_FILE, then in the replicated `ly_enable_gems` call in the install layout CMakeLists.txt, supplied both the GEMS and GEM_FILE argument which are mutually exclusive, due to the `ly_enable_gems` function populating the `ly_enable_gems_GEMS` variable from the content of the `ly_enable_gems_GEM_FILE` file. Furthermore the install layout does not copy over the file that was parsed by the GEM_FILE argument, so it would point to a non-existent file the install layout. * Fixed comment Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
+8
-2
@@ -155,7 +155,13 @@ function(ly_enable_gems)
|
||||
# This will be used to re-create the ly_enable_gems call in the generated CMakeLists.txt at the INSTALL step
|
||||
|
||||
# Replace the CMake list separator with a space to replicate the space separated TARGETS arguments
|
||||
string(REPLACE ";" " " enable_gems_args "${ly_enable_gems_PROJECT_NAME},${ly_enable_gems_GEMS},${ly_enable_gems_GEM_FILE},${ly_enable_gems_VARIANTS},${ly_enable_gems_TARGETS}")
|
||||
if(NOT ly_enable_gems_PROJECT_NAME STREQUAL "__NOPROJECT__")
|
||||
set(replicated_project_name ${ly_enable_gems_PROJECT_NAME})
|
||||
endif()
|
||||
# The GEM_FILE file is used to populate the GEMS argument via the ENABLED_GEMS variable in the file.
|
||||
# Furthermore the GEM_FILE itself is not copied over to the install layout, so make its argument entry blank and use the list of GEMS
|
||||
# stored in ly_enable_gems_GEMS
|
||||
string(REPLACE ";" " " enable_gems_args "${replicated_project_name},${ly_enable_gems_GEMS},,${ly_enable_gems_VARIANTS},${ly_enable_gems_TARGETS}")
|
||||
set_property(DIRECTORY APPEND PROPERTY LY_ENABLE_GEMS_ARGUMENTS "${enable_gems_args}")
|
||||
endfunction()
|
||||
|
||||
@@ -234,4 +240,4 @@ function(ly_enable_gems_delayed)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
||||
endfunction()
|
||||
|
||||
@@ -151,7 +151,7 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
|
||||
cmake_path(RELATIVE_PATH include BASE_DIRECTORY ${LY_ROOT_FOLDER} OUTPUT_VARIABLE target_include)
|
||||
cmake_path(NORMAL_PATH target_include)
|
||||
# Escape the LY_ROOT_FOLDER variable so that it isn't resolved during the install step
|
||||
string(APPEND INCLUDE_DIRECTORIES_PLACEHOLDER "\${LY_ROOT_FOLDER}/${target_include}\n")
|
||||
string(APPEND INCLUDE_DIRECTORIES_PLACEHOLDER "\${LY_ROOT_FOLDER}/${include_location}/${target_include}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -286,22 +286,12 @@ function(ly_setup_subdirectory absolute_target_source_dir)
|
||||
|
||||
# Reproduce the ly_enable_gems() calls made in the the SOURCE_DIR for this target into the CMakeLists.txt that
|
||||
# is about to be generated
|
||||
string(JOIN "\n" enable_gems_template
|
||||
" ly_enable_gems(@enable_gem_PROJECT_NAME@ @enable_gem_GEM@ @enable_gem_GEM_FILE@ @enable_gem_VARIANTS@ @enable_gem_TARGETS@)"
|
||||
"endif()"
|
||||
""
|
||||
)
|
||||
set(enable_gems_template "ly_enable_gems(@enable_gem_PROJECT_NAME@ @enable_gem_GEMS@ @enable_gem_GEM_FILE@ @enable_gem_VARIANTS@ @enable_gem_TARGETS@)\n")
|
||||
get_property(enable_gems_commands_arg_list DIRECTORY ${absolute_target_source_dir} PROPERTY LY_ENABLE_GEMS_ARGUMENTS)
|
||||
foreach(enable_gems_single_command_arg_list ${enable_gems_commands_arg_list})
|
||||
# Split the ly_enable_gems arguments back out based on commas
|
||||
string(REPLACE "," ";" ly_enable_gems_single_command_arg_list "${enable_gems_single_command_arg_list}")
|
||||
list(POP_FRONT enable_gems_single_command_arg_list enable_gem_PROJECT_NAME)
|
||||
list(POP_FRONT enable_gems_single_command_arg_list enable_gem_GEM)
|
||||
list(POP_FRONT enable_gems_single_command_arg_list enable_gem_GEM_FILE)
|
||||
list(POP_FRONT enable_gems_single_command_arg_list enable_gem_GEM)
|
||||
list(POP_FRONT enable_gems_single_command_arg_list enable_gem_VARIANTS)
|
||||
list(POP_FRONT enable_gems_single_command_arg_list enable_gem_TARGETS)
|
||||
foreach(enable_gem_arg_kw IN ITEMS PROJECT_NAME GEM GEM_FILE GEM VARIANTS TARGETS)
|
||||
string(REPLACE "," ";" enable_gems_single_command_arg_list "${enable_gems_single_command_arg_list}")
|
||||
foreach(enable_gem_arg_kw IN ITEMS PROJECT_NAME GEMS GEM_FILE VARIANTS TARGETS)
|
||||
list(POP_FRONT enable_gems_single_command_arg_list enable_gem_${enable_gem_arg_kw})
|
||||
if(enable_gem_${enable_gem_arg_kw})
|
||||
# if the argument exist append to argument keyword to the front
|
||||
|
||||
@@ -184,7 +184,14 @@ function(ly_delayed_generate_settings_registry)
|
||||
|
||||
list(JOIN target_gem_dependencies_names ",\n" target_gem_dependencies_names)
|
||||
string(CONFIGURE ${gems_json_template} gem_json @ONLY)
|
||||
if(prefix)
|
||||
get_target_property(is_imported ${target} IMPORTED)
|
||||
if(is_imported)
|
||||
unset(target_dir)
|
||||
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
|
||||
string(TOUPPER ${conf} UCONF)
|
||||
string(APPEND target_dir $<$<CONFIG:${conf}>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${UCONF}}>)
|
||||
endforeach()
|
||||
elseif(prefix)
|
||||
set(target_dir $<TARGET_FILE_DIR:${prefix}>)
|
||||
else()
|
||||
set(target_dir $<TARGET_FILE_DIR:${target}>)
|
||||
|
||||
Reference in New Issue
Block a user