Skip to content

Commit 319bd33

Browse files
Merge pull request #452 from drodriguez/fix-regex-windows
[cmake] Skip regex when CMAKE_STATIC_LIBRARY_PREFIX is empty.
2 parents 6e1825a + e0dced0 commit 319bd33

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmake/modules/SwiftSupport.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,12 @@ function(add_swift_target target)
153153
add_library(${target}-static STATIC ${objs})
154154
add_dependencies(${target}-static ${AST_DEPENDS})
155155
get_filename_component(ast_output_bn ${AST_OUTPUT} NAME)
156-
string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" ast_output_bn ${ast_output_bn})
157-
string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" ast_output_bn ${ast_output_bn})
156+
if(NOT CMAKE_STATIC_LIBRARY_PREFIX STREQUAL "")
157+
string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" ast_output_bn ${ast_output_bn})
158+
endif()
159+
if(NOT CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL "")
160+
string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" ast_output_bn ${ast_output_bn})
161+
endif()
158162
get_filename_component(ast_output_dn ${AST_OUTPUT} DIRECTORY)
159163
set_target_properties(${target}-static
160164
PROPERTIES

0 commit comments

Comments
 (0)