diff --git a/cmake/modules/SwiftSupport.cmake b/cmake/modules/SwiftSupport.cmake index 60f8b45a3..adcf42fbc 100644 --- a/cmake/modules/SwiftSupport.cmake +++ b/cmake/modules/SwiftSupport.cmake @@ -153,8 +153,12 @@ function(add_swift_target target) add_library(${target}-static STATIC ${objs}) add_dependencies(${target}-static ${AST_DEPENDS}) get_filename_component(ast_output_bn ${AST_OUTPUT} NAME) - string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" ast_output_bn ${ast_output_bn}) - string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" ast_output_bn ${ast_output_bn}) + if(NOT CMAKE_STATIC_LIBRARY_PREFIX STREQUAL "") + string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" ast_output_bn ${ast_output_bn}) + endif() + if(NOT CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL "") + string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" ast_output_bn ${ast_output_bn}) + endif() get_filename_component(ast_output_dn ${AST_OUTPUT} DIRECTORY) set_target_properties(${target}-static PROPERTIES