fix resources names with symlinks

This commit is contained in:
Jake Hillion 2023-07-05 10:30:05 -07:00 committed by Jake Hillion
parent b1e98ddf34
commit b574eb7566

View File

@ -14,17 +14,18 @@ function(embed_headers output)
foreach(header ${HEADERS}) foreach(header ${HEADERS})
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${header}) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${header})
file(REAL_PATH ${header} file_real_path) file(REAL_PATH ${header} header_path)
set(include_path ${CMAKE_CURRENT_SOURCE_DIR}/../include) file(REAL_PATH ${CMAKE_SOURCE_DIR}/include include_path)
file(REAL_PATH ${CMAKE_SOURCE_DIR} base_path)
cmake_path(IS_PREFIX include_path ${file_real_path} NORMALIZE in_include) cmake_path(IS_PREFIX include_path ${header_path} NORMALIZE in_include)
if (${in_include}) if (${in_include})
file(RELATIVE_PATH file_rel_path ${include_path} ${file_real_path}) file(RELATIVE_PATH header_rel_path ${include_path} ${header_path})
else() else()
file(RELATIVE_PATH file_rel_path ${CMAKE_CURRENT_SOURCE_DIR}/.. ${file_real_path}) file(RELATIVE_PATH header_rel_path ${base_path} ${header_path})
endif() endif()
string(MAKE_C_IDENTIFIER ${file_rel_path} varname) string(MAKE_C_IDENTIFIER ${header_rel_path} varname)
get_filename_component(filename ${header} NAME) get_filename_component(filename ${header} NAME)
file(READ ${header} contents) file(READ ${header} contents)