Merge pull request #257 from drodriguez/fix-regex-windows

[cmake] Skip regex when CMAKE_STATIC_LIBRARY_PREFIX is empty.
diff --git a/cmake/modules/SwiftSupport.cmake b/cmake/modules/SwiftSupport.cmake
index 52e9af1..ce34499 100644
--- a/cmake/modules/SwiftSupport.cmake
+++ b/cmake/modules/SwiftSupport.cmake
@@ -155,8 +155,12 @@
       add_dependencies(${target}-static ${AST_DEPENDS})
     endif()
     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