2021-07-29 11:47:35 -05:00
|
|
|
function(z_vcpkg_clean_executables_in_bin_remove_directory_if_empty directory)
|
|
|
|
if(NOT EXISTS "${directory}")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT IS_DIRECTORY "${directory}")
|
|
|
|
message(FATAL_ERROR "${directory} must be a directory")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB items "${directory}/*")
|
|
|
|
if("${items}" STREQUAL "")
|
|
|
|
file(REMOVE_RECURSE "${directory}")
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
2020-05-02 06:28:55 +08:00
|
|
|
function(vcpkg_clean_executables_in_bin)
|
2021-07-29 11:47:35 -05:00
|
|
|
cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "FILE_NAMES")
|
2020-05-02 06:28:55 +08:00
|
|
|
|
2021-07-29 11:47:35 -05:00
|
|
|
if(NOT DEFINED arg_FILE_NAMES)
|
2020-05-02 06:28:55 +08:00
|
|
|
message(FATAL_ERROR "FILE_NAMES must be specified.")
|
|
|
|
endif()
|
|
|
|
|
2021-07-29 11:47:35 -05:00
|
|
|
if(DEFINED arg_UNPARSED_ARGUMENTS)
|
|
|
|
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
foreach(file_name IN LISTS arg_FILE_NAMES)
|
2020-05-02 06:28:55 +08:00
|
|
|
file(REMOVE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
|
2020-11-06 03:16:47 +01:00
|
|
|
"${CURRENT_PACKAGES_DIR}/bin/${file_name}.pdb"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/bin/${file_name}.pdb"
|
2020-05-02 06:28:55 +08:00
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
2021-07-29 11:47:35 -05:00
|
|
|
z_vcpkg_clean_executables_in_bin_remove_directory_if_empty("${CURRENT_PACKAGES_DIR}/bin")
|
|
|
|
z_vcpkg_clean_executables_in_bin_remove_directory_if_empty("${CURRENT_PACKAGES_DIR}/debug/bin")
|
2020-05-02 06:28:55 +08:00
|
|
|
endfunction()
|