Skip to content

Commit

Permalink
fix: cmake install prefix path substitution
Browse files Browse the repository at this point in the history
when creating uninstall target, the CMAKE_INSTALL_PREFIX
may contains white spaces causing substitution
errors.
  • Loading branch information
msclock committed Feb 20, 2024
1 parent f664ebe commit 79cc472
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cmake/install/Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,24 @@ foreach(file \${files})
endforeach()
function(get_empty_dir check_dir result_dirs)
file(GLOB_RECURSE DIR_CONTENTS LIST_DIRECTORIES true RELATIVE \${check_dir} \${check_dir}/*)
list(REVERSE DIR_CONTENTS)
file(GLOB_RECURSE check_dirs LIST_DIRECTORIES true \"\${check_dir}/*\")
list(REVERSE check_dirs)
list(APPEND check_dirs \${check_dir})
foreach(ITEM \${DIR_CONTENTS})
if(IS_DIRECTORY \${check_dir}/\${ITEM})
file(GLOB_RECURSE SUBDIR_CONTENTS \${check_dir}/\${ITEM}/*)
foreach(item \${check_dirs})
if(IS_DIRECTORY \${item})
file(GLOB_RECURSE dir_item_subdirs \"\${item}/*\")
if(NOT SUBDIR_CONTENTS)
list(APPEND _empty \${check_dir}/\${ITEM})
if(NOT dir_item_subdirs)
list(APPEND _empty \${item})
endif()
endif()
endforeach()
set(\${result_dirs} \${_empty} PARENT_SCOPE)
endfunction()
get_empty_dir(@CMAKE_INSTALL_PREFIX@ result_dirs)
get_empty_dir(\"@CMAKE_INSTALL_PREFIX@\" result_dirs)
foreach(empty_dir \${result_dirs})
file(REMOVE_RECURSE \${empty_dir})
Expand Down

0 comments on commit 79cc472

Please # to comment.