Skip to content

Commit d426a71

Browse files
committed
build: remove nested tautological condition (NFC)
The entire if block is in the `SWIFTLIB_TARGET_LIBRARY` condition, so these checks add nothing but a level of indentation. (NFC)
1 parent 36f77a8 commit d426a71

File tree

1 file changed

+37
-41
lines changed

1 file changed

+37
-41
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,32 +1869,30 @@ function(add_swift_library name)
18691869
set(resource_dir_sdk_subdir "${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
18701870
precondition(resource_dir_sdk_subdir)
18711871

1872-
if(SWIFTLIB_TARGET_LIBRARY)
1873-
if(SWIFTLIB_SHARED)
1874-
set(resource_dir "swift")
1875-
set(file_permissions
1876-
OWNER_READ OWNER_WRITE OWNER_EXECUTE
1877-
GROUP_READ GROUP_EXECUTE
1878-
WORLD_READ WORLD_EXECUTE)
1879-
else()
1880-
set(resource_dir "swift_static")
1881-
set(file_permissions
1882-
OWNER_READ OWNER_WRITE
1883-
GROUP_READ
1884-
WORLD_READ)
1885-
endif()
1872+
if(SWIFTLIB_SHARED)
1873+
set(resource_dir "swift")
1874+
set(file_permissions
1875+
OWNER_READ OWNER_WRITE OWNER_EXECUTE
1876+
GROUP_READ GROUP_EXECUTE
1877+
WORLD_READ WORLD_EXECUTE)
1878+
else()
1879+
set(resource_dir "swift_static")
1880+
set(file_permissions
1881+
OWNER_READ OWNER_WRITE
1882+
GROUP_READ
1883+
WORLD_READ)
1884+
endif()
18861885

1887-
swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
1888-
FILES "${UNIVERSAL_LIBRARY_NAME}"
1889-
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
1890-
PERMISSIONS ${file_permissions})
1891-
swift_is_installing_component("${SWIFTLIB_INSTALL_IN_COMPONENT}" is_installing)
1886+
swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
1887+
FILES "${UNIVERSAL_LIBRARY_NAME}"
1888+
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
1889+
PERMISSIONS ${file_permissions})
1890+
swift_is_installing_component("${SWIFTLIB_INSTALL_IN_COMPONENT}" is_installing)
18921891

1893-
if(NOT is_installing)
1894-
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${VARIANT_NAME})
1895-
else()
1896-
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${VARIANT_NAME})
1897-
endif()
1892+
if(NOT is_installing)
1893+
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${VARIANT_NAME})
1894+
else()
1895+
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${VARIANT_NAME})
18981896
endif()
18991897

19001898
# If we built static variants of the library, create a lipo target for
@@ -1928,26 +1926,24 @@ function(add_swift_library name)
19281926

19291927
# Add Swift standard library targets as dependencies to the top-level
19301928
# convenience target.
1931-
if(SWIFTLIB_TARGET_LIBRARY)
1932-
set(FILTERED_UNITTESTS
1933-
swiftStdlibCollectionUnittest
1934-
swiftStdlibUnicodeUnittest)
1935-
1936-
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
1937-
set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
1938-
if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND
1939-
TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
1940-
add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
1929+
set(FILTERED_UNITTESTS
1930+
swiftStdlibCollectionUnittest
1931+
swiftStdlibUnicodeUnittest)
1932+
1933+
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
1934+
set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
1935+
if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND
1936+
TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
1937+
add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
1938+
${lipo_target}
1939+
${lipo_target_static})
1940+
if(NOT "${name}" IN_LIST FILTERED_UNITTESTS)
1941+
add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
19411942
${lipo_target}
19421943
${lipo_target_static})
1943-
if(NOT "${name}" IN_LIST FILTERED_UNITTESTS)
1944-
add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
1945-
${lipo_target}
1946-
${lipo_target_static})
1947-
endif()
19481944
endif()
1949-
endforeach()
1950-
endif()
1945+
endif()
1946+
endforeach()
19511947
endif()
19521948
endforeach()
19531949
else()

0 commit comments

Comments
 (0)