[cmake] Eliminate dead target code from add_swift_host_library and dead host code from add_swift_target_library.

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -1580,444 +1580,74 @@
         "Either SHARED, STATIC, or OBJECT_LIBRARY must be specified")
   endif()

-  if(SWIFTLIB_TARGET_LIBRARY)
-    # In the standard library and overlays, warn about implicit overrides
-    # as a reminder to consider when inherited protocols need different
-    # behavior for their requirements.
-    if (SWIFTLIB_IS_STDLIB)
-      list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-warn-implicit-overrides")
-    endif()
-
-    if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER AND NOT BUILD_STANDALONE)
-      list(APPEND SWIFTLIB_DEPENDS clang)
-    endif()
-
-    # If we are building this library for targets, loop through the various
-    # SDKs building the variants of this library.
-    list_intersect(
-        "${SWIFTLIB_TARGET_SDKS}" "${SWIFT_SDKS}" SWIFTLIB_TARGET_SDKS)
-    if(SWIFTLIB_FORCE_BUILD_FOR_HOST_SDK)
-      list_union(
-          "${SWIFTLIB_TARGET_SDKS}" "${SWIFT_HOST_VARIANT_SDK}"
-          SWIFTLIB_TARGET_SDKS)
-    endif()
-
-    foreach(sdk ${SWIFTLIB_TARGET_SDKS})
-      if(NOT SWIFT_SDK_${sdk}_ARCHITECTURES)
-        # SWIFT_SDK_${sdk}_ARCHITECTURES is empty, so just continue
-        continue()
-      endif()
-
-      set(THIN_INPUT_TARGETS)
-
-      # Collect architecture agnostic SDK module dependencies
-      set(swiftlib_module_depends_flattened ${SWIFTLIB_SWIFT_MODULE_DEPENDS})
-      if(${sdk} STREQUAL OSX)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_OSX})
-      elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_IOS})
-      elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_TVOS})
-      elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_WATCHOS})
-      elseif(${sdk} STREQUAL FREEBSD)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_FREEBSD})
-      elseif(${sdk} STREQUAL LINUX OR ${sdk} STREQUAL ANDROID)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_LINUX})
-      elseif(${sdk} STREQUAL CYGWIN)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_CYGWIN})
-      elseif(${sdk} STREQUAL HAIKU)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_HAIKU})
-      endif()
-
-      # Collect architecture agnostic SDK framework dependencies
-      set(swiftlib_framework_depends_flattened ${SWIFTLIB_FRAMEWORK_DEPENDS})
-      if(${sdk} STREQUAL OSX)
-        list(APPEND swiftlib_framework_depends_flattened
-             ${SWIFTLIB_FRAMEWORK_DEPENDS_OSX})
-      elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR OR
-             ${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
-        list(APPEND swiftlib_framework_depends_flattened
-             ${SWIFTLIB_FRAMEWORK_DEPENDS_IOS_TVOS})
-      endif()
-
-      # Collect architecutre agnostic compiler flags
-      set(swiftlib_swift_compile_flags_all ${SWIFTLIB_SWIFT_COMPILE_FLAGS})
-      if(${sdk} STREQUAL OSX)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_OSX})
-      elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_IOS})
-      elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_TVOS})
-      elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_WATCHOS})
-      elseif(${sdk} STREQUAL WINDOWS)
-        # FIXME(SR2005) static and shared are not mutually exclusive; however
-        # since we do a single build of the sources, this doesn't work for
-        # building both simultaneously.  Effectively, only shared builds are
-        # supported on windows currently.
-        if(SWIFTLIB_SHARED)
-          list(APPEND swiftlib_swift_compile_flags_all -D_USRDLL)
-          if(SWIFTLIB_IS_STDLIB_CORE)
-            list(APPEND swiftlib_swift_compile_flags_all -DswiftCore_EXPORTS)
-          endif()
-        elseif(SWIFTLIB_STATIC)
-          list(APPEND swiftlib_swift_compile_flags_all -D_LIB)
-        endif()
-      endif()
-
-
-      # Collect architecture agnostic SDK linker flags
-      set(swiftlib_link_flags_all ${SWIFTLIB_LINK_FLAGS})
-      if(${sdk} STREQUAL IOS_SIMULATOR AND ${name} STREQUAL swiftMediaPlayer)
-        # message("DISABLING AUTOLINK FOR swiftMediaPlayer")
-        list(APPEND swiftlib_link_flags_all "-Xlinker" "-ignore_auto_link")
-      endif()
-
-      # We unconditionally removed "-z,defs" from CMAKE_SHARED_LINKER_FLAGS in
-      # swift_common_standalone_build_config_llvm within
-      # SwiftSharedCMakeConfig.cmake, where it was added by a call to
-      # HandleLLVMOptions.
-      #
-      # Rather than applying it to all targets and libraries, we here add it
-      # back to supported targets and libraries only.  This is needed for ELF
-      # targets only; however, RemoteMirror needs to build with undefined
-      # symbols.
-      if(${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF AND
-         NOT ${name} STREQUAL swiftRemoteMirror)
-        list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
-      endif()
-
-      # For each architecture supported by this SDK
-      foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
-        # Configure variables for this subdirectory.
-        set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
-        set(VARIANT_NAME "${name}${VARIANT_SUFFIX}")
-        set(MODULE_VARIANT_SUFFIX "-swiftmodule${VARIANT_SUFFIX}")
-        set(MODULE_VARIANT_NAME "${name}${MODULE_VARIANT_SUFFIX}")
-
-        # Map dependencies over to the appropriate variants.
-        set(swiftlib_link_libraries)
-        foreach(lib ${SWIFTLIB_LINK_LIBRARIES})
-          if(TARGET "${lib}${VARIANT_SUFFIX}")
-            list(APPEND swiftlib_link_libraries "${lib}${VARIANT_SUFFIX}")
-          else()
-            list(APPEND swiftlib_link_libraries "${lib}")
-          endif()
-        endforeach()
-
-        # Swift compiles depend on swift modules, while links depend on
-        # linked libraries.  Find targets for both of these here.
-        set(swiftlib_module_dependency_targets)
-        set(swiftlib_private_link_libraries_targets)
-
-        if(NOT BUILD_STANDALONE)
-          foreach(mod ${swiftlib_module_depends_flattened})
-            list(APPEND swiftlib_module_dependency_targets
-                "swift${mod}${MODULE_VARIANT_SUFFIX}")
-
-            list(APPEND swiftlib_private_link_libraries_targets
-                "swift${mod}${VARIANT_SUFFIX}")
-          endforeach()
-        endif()
-
-        foreach(lib ${SWIFTLIB_PRIVATE_LINK_LIBRARIES})
-          if("${lib}" STREQUAL "ICU_UC")
-            list(APPEND swiftlib_private_link_libraries_targets
-                 "${SWIFT_${sdk}_${arch}_ICU_UC}")
-            # temporary fix for atomic needing to be
-            # after object files for libswiftCore.so
-            if("${sdk}" STREQUAL "ANDROID")
-              list(APPEND swiftlib_private_link_libraries_targets
-                   "-latomic")
-            # the same issue on FreeBSD, missing symbols:
-            # __atomic_store, __atomic_compare_exchange, __atomic_load
-            elseif("${sdk}" STREQUAL "FREEBSD")
-              list(APPEND swiftlib_private_link_libraries_targets
-                   "${SWIFTLIB_DIR}/clang/lib/freebsd/libclang_rt.builtins-${arch}.a")
-            endif()
-          elseif("${lib}" STREQUAL "ICU_I18N")
-            list(APPEND swiftlib_private_link_libraries_targets
-                 "${SWIFT_${sdk}_${arch}_ICU_I18N}")
-          elseif(TARGET "${lib}${VARIANT_SUFFIX}")
-            list(APPEND swiftlib_private_link_libraries_targets
-                "${lib}${VARIANT_SUFFIX}")
-          else()
-            list(APPEND swiftlib_private_link_libraries_targets "${lib}")
-          endif()
-        endforeach()
-
-        # Add PrivateFrameworks, rdar://28466433
-        if(SWIFTLIB_IS_SDK_OVERLAY)
-          set(swiftlib_swift_compile_private_frameworks_flag "-Fsystem" "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/System/Library/PrivateFrameworks/")
-        endif()
-
-        # Add this library variant.
-        _add_swift_library_single(
-          ${VARIANT_NAME}
-          ${name}
-          ${SWIFTLIB_SHARED_keyword}
-          ${SWIFTLIB_STATIC_keyword}
-          ${SWIFTLIB_OBJECT_LIBRARY_keyword}
-          ${SWIFTLIB_SOURCES}
-          MODULE_TARGET ${MODULE_VARIANT_NAME}
-          SDK ${sdk}
-          ARCHITECTURE ${arch}
-          DEPENDS ${SWIFTLIB_DEPENDS}
-          LINK_LIBRARIES ${swiftlib_link_libraries}
-          FRAMEWORK_DEPENDS ${swiftlib_framework_depends_flattened}
-          FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
-          LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
-          FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS} ${swiftlib_module_dependency_targets}
-          C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
-          SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all} ${swiftlib_swift_compile_private_frameworks_flag}
-          LINK_FLAGS ${swiftlib_link_flags_all}
-          PRIVATE_LINK_LIBRARIES ${swiftlib_private_link_libraries_targets}
-          INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}
-          INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY}
-          ${SWIFTLIB_DONT_EMBED_BITCODE_keyword}
-          ${SWIFTLIB_API_NOTES_NON_OVERLAY_keyword}
-          ${SWIFTLIB_IS_STDLIB_keyword}
-          ${SWIFTLIB_IS_STDLIB_CORE_keyword}
-          ${SWIFTLIB_IS_SDK_OVERLAY_keyword}
-          ${SWIFTLIB_TARGET_LIBRARY_keyword}
-          ${SWIFTLIB_FORCE_BUILD_FOR_HOST_SDK_keyword}
-          ${SWIFTLIB_FORCE_BUILD_OPTIMIZED_keyword}
-          ${SWIFTLIB_NOSWIFTRT_keyword}
-          INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
-          DEPLOYMENT_VERSION_OSX "${SWIFTLIB_DEPLOYMENT_VERSION_OSX}"
-          DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
-          DEPLOYMENT_VERSION_TVOS "${SWIFTLIB_DEPLOYMENT_VERSION_TVOS}"
-          DEPLOYMENT_VERSION_WATCHOS "${SWIFTLIB_DEPLOYMENT_VERSION_WATCHOS}"
-        )
-
-        if(NOT SWIFTLIB_OBJECT_LIBRARY)
-          # Add dependencies on the (not-yet-created) custom lipo target.
-          foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
-            if (NOT "${DEP}" STREQUAL "icucore")
-              add_dependencies(${VARIANT_NAME}
-                "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
-            endif()
-          endforeach()
-
-          if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
-            # Add dependencies on the (not-yet-created) custom lipo target.
-            foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
-              if (NOT "${DEP}" STREQUAL "icucore")
-                add_dependencies("${VARIANT_NAME}-static"
-                  "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
-              endif()
-            endforeach()
-          endif()
-
-          # Note this thin library.
-          list(APPEND THIN_INPUT_TARGETS ${VARIANT_NAME})
-        endif()
-      endforeach()
-
-      if(NOT SWIFTLIB_OBJECT_LIBRARY)
-        # Determine the name of the universal library.
-        if(SWIFTLIB_SHARED)
-          if("${sdk}" STREQUAL "WINDOWS")
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${name}.dll")
-          else()
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-          endif()
-        else()
-          if("${sdk}" STREQUAL "WINDOWS")
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${name}.lib")
-          else()
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-          endif()
-        endif()
-
-        set(lipo_target "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
-        if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND SWIFTLIB_SHARED)
-          set(codesign_arg CODESIGN)
-        endif()
-        precondition(THIN_INPUT_TARGETS)
-        _add_swift_lipo_target(SDK
-                                 ${sdk}
-                               TARGET
-                                 ${lipo_target}
-                               OUTPUT
-                                 ${UNIVERSAL_LIBRARY_NAME}
-                               ${codesign_arg}
-                               ${THIN_INPUT_TARGETS})
-
-        # Cache universal libraries for dependency purposes
-        set(UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}
-          ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}}
-          ${lipo_target}
-          CACHE INTERNAL "UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
-
-        # Determine the subdirectory where this library will be installed.
-        set(resource_dir_sdk_subdir "${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
-        precondition(resource_dir_sdk_subdir)
-
-        if(SWIFTLIB_SHARED)
-          set(resource_dir "swift")
-          set(file_permissions
-              OWNER_READ OWNER_WRITE OWNER_EXECUTE
-              GROUP_READ GROUP_EXECUTE
-              WORLD_READ WORLD_EXECUTE)
-        else()
-          set(resource_dir "swift_static")
-          set(file_permissions
-              OWNER_READ OWNER_WRITE
-              GROUP_READ
-              WORLD_READ)
-        endif()
-
-        swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
-            FILES "${UNIVERSAL_LIBRARY_NAME}"
-            DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
-            PERMISSIONS ${file_permissions})
-        swift_is_installing_component("${SWIFTLIB_INSTALL_IN_COMPONENT}" is_installing)
-
-        if(NOT is_installing)
-          set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${VARIANT_NAME})
-        else()
-          set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${VARIANT_NAME})
-        endif()
-
-        # If we built static variants of the library, create a lipo target for
-        # them.
-        set(lipo_target_static)
-        if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
-          set(THIN_INPUT_TARGETS_STATIC)
-          foreach(TARGET ${THIN_INPUT_TARGETS})
-            list(APPEND THIN_INPUT_TARGETS_STATIC "${TARGET}-static")
-          endforeach()
-
-          set(lipo_target_static
-              "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
-          set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTSTATICLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-          _add_swift_lipo_target(SDK
-                                   ${sdk}
-                                 TARGET
-                                   ${lipo_target_static}
-                                 OUTPUT
-                                   "${UNIVERSAL_LIBRARY_NAME}"
-                                 ${THIN_INPUT_TARGETS_STATIC})
-          swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
-              FILES "${UNIVERSAL_LIBRARY_NAME}"
-              DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift_static/${resource_dir_sdk_subdir}"
-              PERMISSIONS
-                OWNER_READ OWNER_WRITE
-                GROUP_READ
-                WORLD_READ)
-        endif()
-
-        # Add Swift standard library targets as dependencies to the top-level
-        # convenience target.
-        set(FILTERED_UNITTESTS
-              swiftStdlibCollectionUnittest
-              swiftStdlibUnicodeUnittest)
-
-        foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
-          set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
-          if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND
-             TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
-            add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
-                ${lipo_target}
-                ${lipo_target_static})
-            if(NOT "${name}" IN_LIST FILTERED_UNITTESTS)
-              add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
-                  ${lipo_target}
-                  ${lipo_target_static})
-            endif()
-          endif()
-        endforeach()
-      endif()
-    endforeach()
-  else()
-    set(sdk "${SWIFT_HOST_VARIANT_SDK}")
-    set(arch "${SWIFT_HOST_VARIANT_ARCH}")
-
-    # Collect compiler flags
-    set(swiftlib_swift_compile_flags_all ${SWIFTLIB_SWIFT_COMPILE_FLAGS})
-    if("${sdk}" STREQUAL "OSX")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_OSX})
-    elseif("${sdk}" STREQUAL "IOS" OR "${sdk}" STREQUAL "IOS_SIMULATOR")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_IOS})
-    elseif("${sdk}" STREQUAL "TVOS" OR "${sdk}" STREQUAL "TVOS_SIMULATOR")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_TVOS})
-    elseif("${sdk}" STREQUAL "WATCHOS" OR "${sdk}" STREQUAL "WATCHOS_SIMULATOR")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_WATCHOS})
-    endif()
-
-    _add_swift_library_single(
-      ${name}
-      ${name}
-      ${SWIFTLIB_SHARED_keyword}
-      ${SWIFTLIB_STATIC_keyword}
-      ${SWIFTLIB_OBJECT_LIBRARY_keyword}
-      ${SWIFTLIB_SOURCES}
-      SDK ${sdk}
-      ARCHITECTURE ${arch}
-      DEPENDS ${SWIFTLIB_DEPENDS}
-      LINK_LIBRARIES ${SWIFTLIB_LINK_LIBRARIES}
-      FRAMEWORK_DEPENDS ${SWIFTLIB_FRAMEWORK_DEPENDS}
-      FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
-      LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
-      FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS}
-      C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
-      SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all}
-      LINK_FLAGS ${SWIFTLIB_LINK_FLAGS}
-      PRIVATE_LINK_LIBRARIES ${SWIFTLIB_PRIVATE_LINK_LIBRARIES}
-      INTERFACE_LINK_LIBRARIES ${SWIFTLIB_INTERFACE_LINK_LIBRARIES}
-      INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}
-      INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY}
-      ${SWIFTLIB_DONT_EMBED_BITCODE_keyword}
-      ${SWIFTLIB_API_NOTES_NON_OVERLAY_keyword}
-      ${SWIFTLIB_IS_STDLIB_keyword}
-      ${SWIFTLIB_IS_STDLIB_CORE_keyword}
-      ${SWIFTLIB_IS_SDK_OVERLAY_keyword}
-      INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
-      DEPLOYMENT_VERSION_OSX "${SWIFTLIB_DEPLOYMENT_VERSION_OSX}"
-      DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
-      DEPLOYMENT_VERSION_TVOS "${SWIFTLIB_DEPLOYMENT_VERSION_TVOS}"
-      DEPLOYMENT_VERSION_WATCHOS "${SWIFTLIB_DEPLOYMENT_VERSION_WATCHOS}"
-      )
-
-      swift_install_in_component(dev
-          TARGETS ${name}
-          ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-          LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-          RUNTIME DESTINATION bin)
-      swift_is_installing_component(dev is_installing)
-
-      if(NOT is_installing)
-        set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${name})
-      else()
-        set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${name})
-      endif()
-  endif()
-
   precondition(SWIFTLIB_TARGET_LIBRARY NEGATE
     MESSAGE "TARGET_LIBRARY inferred in add_swift_host_library?!")
+
+  set(sdk "${SWIFT_HOST_VARIANT_SDK}")
+  set(arch "${SWIFT_HOST_VARIANT_ARCH}")
+
+  # Collect compiler flags
+  set(swiftlib_swift_compile_flags_all ${SWIFTLIB_SWIFT_COMPILE_FLAGS})
+  if("${sdk}" STREQUAL "OSX")
+    list(APPEND swiftlib_swift_compile_flags_all
+      ${SWIFTLIB_SWIFT_COMPILE_FLAGS_OSX})
+  elseif("${sdk}" STREQUAL "IOS" OR "${sdk}" STREQUAL "IOS_SIMULATOR")
+    list(APPEND swiftlib_swift_compile_flags_all
+      ${SWIFTLIB_SWIFT_COMPILE_FLAGS_IOS})
+  elseif("${sdk}" STREQUAL "TVOS" OR "${sdk}" STREQUAL "TVOS_SIMULATOR")
+    list(APPEND swiftlib_swift_compile_flags_all
+      ${SWIFTLIB_SWIFT_COMPILE_FLAGS_TVOS})
+  elseif("${sdk}" STREQUAL "WATCHOS" OR "${sdk}" STREQUAL "WATCHOS_SIMULATOR")
+    list(APPEND swiftlib_swift_compile_flags_all
+      ${SWIFTLIB_SWIFT_COMPILE_FLAGS_WATCHOS})
+  endif()
+
+  _add_swift_library_single(
+    ${name}
+    ${name}
+    ${SWIFTLIB_SHARED_keyword}
+    ${SWIFTLIB_STATIC_keyword}
+    ${SWIFTLIB_OBJECT_LIBRARY_keyword}
+    ${SWIFTLIB_SOURCES}
+    SDK ${sdk}
+    ARCHITECTURE ${arch}
+    DEPENDS ${SWIFTLIB_DEPENDS}
+    LINK_LIBRARIES ${SWIFTLIB_LINK_LIBRARIES}
+    FRAMEWORK_DEPENDS ${SWIFTLIB_FRAMEWORK_DEPENDS}
+    FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
+    LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
+    FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS}
+    C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
+    SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all}
+    LINK_FLAGS ${SWIFTLIB_LINK_FLAGS}
+    PRIVATE_LINK_LIBRARIES ${SWIFTLIB_PRIVATE_LINK_LIBRARIES}
+    INTERFACE_LINK_LIBRARIES ${SWIFTLIB_INTERFACE_LINK_LIBRARIES}
+    INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}
+    INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY}
+    ${SWIFTLIB_DONT_EMBED_BITCODE_keyword}
+    ${SWIFTLIB_API_NOTES_NON_OVERLAY_keyword}
+    ${SWIFTLIB_IS_STDLIB_keyword}
+    ${SWIFTLIB_IS_STDLIB_CORE_keyword}
+    ${SWIFTLIB_IS_SDK_OVERLAY_keyword}
+    INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
+    DEPLOYMENT_VERSION_OSX "${SWIFTLIB_DEPLOYMENT_VERSION_OSX}"
+    DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
+    DEPLOYMENT_VERSION_TVOS "${SWIFTLIB_DEPLOYMENT_VERSION_TVOS}"
+    DEPLOYMENT_VERSION_WATCHOS "${SWIFTLIB_DEPLOYMENT_VERSION_WATCHOS}"
+    )
+
+  swift_install_in_component(dev
+    TARGETS ${name}
+    ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+    LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+    RUNTIME DESTINATION bin)
+  swift_is_installing_component(dev is_installing)
+
+  if(NOT is_installing)
+    set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${name})
+  else()
+    set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${name})
+  endif()
 endfunction()

 # Add a new Swift target library.
@@ -2282,444 +1912,376 @@
         "Either SHARED, STATIC, or OBJECT_LIBRARY must be specified")
   endif()

-  if(SWIFTLIB_TARGET_LIBRARY)
-    # In the standard library and overlays, warn about implicit overrides
-    # as a reminder to consider when inherited protocols need different
-    # behavior for their requirements.
-    if (SWIFTLIB_IS_STDLIB)
-      list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-warn-implicit-overrides")
-    endif()
-
-    if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER AND NOT BUILD_STANDALONE)
-      list(APPEND SWIFTLIB_DEPENDS clang)
-    endif()
-
-    # If we are building this library for targets, loop through the various
-    # SDKs building the variants of this library.
-    list_intersect(
-        "${SWIFTLIB_TARGET_SDKS}" "${SWIFT_SDKS}" SWIFTLIB_TARGET_SDKS)
-    if(SWIFTLIB_FORCE_BUILD_FOR_HOST_SDK)
-      list_union(
-          "${SWIFTLIB_TARGET_SDKS}" "${SWIFT_HOST_VARIANT_SDK}"
-          SWIFTLIB_TARGET_SDKS)
-    endif()
-
-    foreach(sdk ${SWIFTLIB_TARGET_SDKS})
-      if(NOT SWIFT_SDK_${sdk}_ARCHITECTURES)
-        # SWIFT_SDK_${sdk}_ARCHITECTURES is empty, so just continue
-        continue()
+  precondition(SWIFTLIB_TARGET_LIBRARY
+    MESSAGE "TARGET_LIBRARY not inferred in add_swift_target_library?!")
+
+  # In the standard library and overlays, warn about implicit overrides
+  # as a reminder to consider when inherited protocols need different
+  # behavior for their requirements.
+  if (SWIFTLIB_IS_STDLIB)
+    list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-warn-implicit-overrides")
+  endif()
+
+  if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER AND NOT BUILD_STANDALONE)
+    list(APPEND SWIFTLIB_DEPENDS clang)
+  endif()
+
+  # If we are building this library for targets, loop through the various
+  # SDKs building the variants of this library.
+  list_intersect(
+      "${SWIFTLIB_TARGET_SDKS}" "${SWIFT_SDKS}" SWIFTLIB_TARGET_SDKS)
+  if(SWIFTLIB_FORCE_BUILD_FOR_HOST_SDK)
+    list_union(
+        "${SWIFTLIB_TARGET_SDKS}" "${SWIFT_HOST_VARIANT_SDK}"
+        SWIFTLIB_TARGET_SDKS)
+  endif()
+
+  foreach(sdk ${SWIFTLIB_TARGET_SDKS})
+    if(NOT SWIFT_SDK_${sdk}_ARCHITECTURES)
+      # SWIFT_SDK_${sdk}_ARCHITECTURES is empty, so just continue
+      continue()
+    endif()
+
+    set(THIN_INPUT_TARGETS)
+
+    # Collect architecture agnostic SDK module dependencies
+    set(swiftlib_module_depends_flattened ${SWIFTLIB_SWIFT_MODULE_DEPENDS})
+    if(${sdk} STREQUAL OSX)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_OSX})
+    elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_IOS})
+    elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_TVOS})
+    elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_WATCHOS})
+    elseif(${sdk} STREQUAL FREEBSD)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_FREEBSD})
+    elseif(${sdk} STREQUAL LINUX OR ${sdk} STREQUAL ANDROID)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_LINUX})
+    elseif(${sdk} STREQUAL CYGWIN)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_CYGWIN})
+    elseif(${sdk} STREQUAL HAIKU)
+      list(APPEND swiftlib_module_depends_flattened
+           ${SWIFTLIB_SWIFT_MODULE_DEPENDS_HAIKU})
+    endif()
+
+    # Collect architecture agnostic SDK framework dependencies
+    set(swiftlib_framework_depends_flattened ${SWIFTLIB_FRAMEWORK_DEPENDS})
+    if(${sdk} STREQUAL OSX)
+      list(APPEND swiftlib_framework_depends_flattened
+           ${SWIFTLIB_FRAMEWORK_DEPENDS_OSX})
+    elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR OR
+           ${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
+      list(APPEND swiftlib_framework_depends_flattened
+           ${SWIFTLIB_FRAMEWORK_DEPENDS_IOS_TVOS})
+    endif()
+
+    # Collect architecutre agnostic compiler flags
+    set(swiftlib_swift_compile_flags_all ${SWIFTLIB_SWIFT_COMPILE_FLAGS})
+    if(${sdk} STREQUAL OSX)
+      list(APPEND swiftlib_swift_compile_flags_all
+           ${SWIFTLIB_SWIFT_COMPILE_FLAGS_OSX})
+    elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
+      list(APPEND swiftlib_swift_compile_flags_all
+           ${SWIFTLIB_SWIFT_COMPILE_FLAGS_IOS})
+    elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
+      list(APPEND swiftlib_swift_compile_flags_all
+           ${SWIFTLIB_SWIFT_COMPILE_FLAGS_TVOS})
+    elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
+      list(APPEND swiftlib_swift_compile_flags_all
+           ${SWIFTLIB_SWIFT_COMPILE_FLAGS_WATCHOS})
+    elseif(${sdk} STREQUAL WINDOWS)
+      # FIXME(SR2005) static and shared are not mutually exclusive; however
+      # since we do a single build of the sources, this doesn't work for
+      # building both simultaneously.  Effectively, only shared builds are
+      # supported on windows currently.
+      if(SWIFTLIB_SHARED)
+        list(APPEND swiftlib_swift_compile_flags_all -D_USRDLL)
+        if(SWIFTLIB_IS_STDLIB_CORE)
+          list(APPEND swiftlib_swift_compile_flags_all -DswiftCore_EXPORTS)
+        endif()
+      elseif(SWIFTLIB_STATIC)
+        list(APPEND swiftlib_swift_compile_flags_all -D_LIB)
       endif()
-
-      set(THIN_INPUT_TARGETS)
-
-      # Collect architecture agnostic SDK module dependencies
-      set(swiftlib_module_depends_flattened ${SWIFTLIB_SWIFT_MODULE_DEPENDS})
-      if(${sdk} STREQUAL OSX)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_OSX})
-      elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_IOS})
-      elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_TVOS})
-      elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_WATCHOS})
-      elseif(${sdk} STREQUAL FREEBSD)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_FREEBSD})
-      elseif(${sdk} STREQUAL LINUX OR ${sdk} STREQUAL ANDROID)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_LINUX})
-      elseif(${sdk} STREQUAL CYGWIN)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_CYGWIN})
-      elseif(${sdk} STREQUAL HAIKU)
-        list(APPEND swiftlib_module_depends_flattened
-             ${SWIFTLIB_SWIFT_MODULE_DEPENDS_HAIKU})
+    endif()
+
+
+    # Collect architecture agnostic SDK linker flags
+    set(swiftlib_link_flags_all ${SWIFTLIB_LINK_FLAGS})
+    if(${sdk} STREQUAL IOS_SIMULATOR AND ${name} STREQUAL swiftMediaPlayer)
+      # message("DISABLING AUTOLINK FOR swiftMediaPlayer")
+      list(APPEND swiftlib_link_flags_all "-Xlinker" "-ignore_auto_link")
+    endif()
+
+    # We unconditionally removed "-z,defs" from CMAKE_SHARED_LINKER_FLAGS in
+    # swift_common_standalone_build_config_llvm within
+    # SwiftSharedCMakeConfig.cmake, where it was added by a call to
+    # HandleLLVMOptions.
+    #
+    # Rather than applying it to all targets and libraries, we here add it
+    # back to supported targets and libraries only.  This is needed for ELF
+    # targets only; however, RemoteMirror needs to build with undefined
+    # symbols.
+    if(${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF AND
+       NOT ${name} STREQUAL swiftRemoteMirror)
+      list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
+    endif()
+
+    # For each architecture supported by this SDK
+    foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
+      # Configure variables for this subdirectory.
+      set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
+      set(VARIANT_NAME "${name}${VARIANT_SUFFIX}")
+      set(MODULE_VARIANT_SUFFIX "-swiftmodule${VARIANT_SUFFIX}")
+      set(MODULE_VARIANT_NAME "${name}${MODULE_VARIANT_SUFFIX}")
+
+      # Map dependencies over to the appropriate variants.
+      set(swiftlib_link_libraries)
+      foreach(lib ${SWIFTLIB_LINK_LIBRARIES})
+        if(TARGET "${lib}${VARIANT_SUFFIX}")
+          list(APPEND swiftlib_link_libraries "${lib}${VARIANT_SUFFIX}")
+        else()
+          list(APPEND swiftlib_link_libraries "${lib}")
+        endif()
+      endforeach()
+
+      # Swift compiles depend on swift modules, while links depend on
+      # linked libraries.  Find targets for both of these here.
+      set(swiftlib_module_dependency_targets)
+      set(swiftlib_private_link_libraries_targets)
+
+      if(NOT BUILD_STANDALONE)
+        foreach(mod ${swiftlib_module_depends_flattened})
+          list(APPEND swiftlib_module_dependency_targets
+              "swift${mod}${MODULE_VARIANT_SUFFIX}")
+
+          list(APPEND swiftlib_private_link_libraries_targets
+              "swift${mod}${VARIANT_SUFFIX}")
+        endforeach()
       endif()

-      # Collect architecture agnostic SDK framework dependencies
-      set(swiftlib_framework_depends_flattened ${SWIFTLIB_FRAMEWORK_DEPENDS})
-      if(${sdk} STREQUAL OSX)
-        list(APPEND swiftlib_framework_depends_flattened
-             ${SWIFTLIB_FRAMEWORK_DEPENDS_OSX})
-      elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR OR
-             ${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
-        list(APPEND swiftlib_framework_depends_flattened
-             ${SWIFTLIB_FRAMEWORK_DEPENDS_IOS_TVOS})
+      foreach(lib ${SWIFTLIB_PRIVATE_LINK_LIBRARIES})
+        if("${lib}" STREQUAL "ICU_UC")
+          list(APPEND swiftlib_private_link_libraries_targets
+               "${SWIFT_${sdk}_${arch}_ICU_UC}")
+          # temporary fix for atomic needing to be
+          # after object files for libswiftCore.so
+          if("${sdk}" STREQUAL "ANDROID")
+            list(APPEND swiftlib_private_link_libraries_targets
+                 "-latomic")
+          # the same issue on FreeBSD, missing symbols:
+          # __atomic_store, __atomic_compare_exchange, __atomic_load
+          elseif("${sdk}" STREQUAL "FREEBSD")
+            list(APPEND swiftlib_private_link_libraries_targets
+                 "${SWIFTLIB_DIR}/clang/lib/freebsd/libclang_rt.builtins-${arch}.a")
+          endif()
+        elseif("${lib}" STREQUAL "ICU_I18N")
+          list(APPEND swiftlib_private_link_libraries_targets
+               "${SWIFT_${sdk}_${arch}_ICU_I18N}")
+        elseif(TARGET "${lib}${VARIANT_SUFFIX}")
+          list(APPEND swiftlib_private_link_libraries_targets
+              "${lib}${VARIANT_SUFFIX}")
+        else()
+          list(APPEND swiftlib_private_link_libraries_targets "${lib}")
+        endif()
+      endforeach()
+
+      # Add PrivateFrameworks, rdar://28466433
+      if(SWIFTLIB_IS_SDK_OVERLAY)
+        set(swiftlib_swift_compile_private_frameworks_flag "-Fsystem" "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/System/Library/PrivateFrameworks/")
       endif()

-      # Collect architecutre agnostic compiler flags
-      set(swiftlib_swift_compile_flags_all ${SWIFTLIB_SWIFT_COMPILE_FLAGS})
-      if(${sdk} STREQUAL OSX)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_OSX})
-      elseif(${sdk} STREQUAL IOS OR ${sdk} STREQUAL IOS_SIMULATOR)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_IOS})
-      elseif(${sdk} STREQUAL TVOS OR ${sdk} STREQUAL TVOS_SIMULATOR)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_TVOS})
-      elseif(${sdk} STREQUAL WATCHOS OR ${sdk} STREQUAL WATCHOS_SIMULATOR)
-        list(APPEND swiftlib_swift_compile_flags_all
-             ${SWIFTLIB_SWIFT_COMPILE_FLAGS_WATCHOS})
-      elseif(${sdk} STREQUAL WINDOWS)
-        # FIXME(SR2005) static and shared are not mutually exclusive; however
-        # since we do a single build of the sources, this doesn't work for
-        # building both simultaneously.  Effectively, only shared builds are
-        # supported on windows currently.
-        if(SWIFTLIB_SHARED)
-          list(APPEND swiftlib_swift_compile_flags_all -D_USRDLL)
-          if(SWIFTLIB_IS_STDLIB_CORE)
-            list(APPEND swiftlib_swift_compile_flags_all -DswiftCore_EXPORTS)
-          endif()
-        elseif(SWIFTLIB_STATIC)
-          list(APPEND swiftlib_swift_compile_flags_all -D_LIB)
-        endif()
-      endif()
-
-
-      # Collect architecture agnostic SDK linker flags
-      set(swiftlib_link_flags_all ${SWIFTLIB_LINK_FLAGS})
-      if(${sdk} STREQUAL IOS_SIMULATOR AND ${name} STREQUAL swiftMediaPlayer)
-        # message("DISABLING AUTOLINK FOR swiftMediaPlayer")
-        list(APPEND swiftlib_link_flags_all "-Xlinker" "-ignore_auto_link")
-      endif()
-
-      # We unconditionally removed "-z,defs" from CMAKE_SHARED_LINKER_FLAGS in
-      # swift_common_standalone_build_config_llvm within
-      # SwiftSharedCMakeConfig.cmake, where it was added by a call to
-      # HandleLLVMOptions.
-      #
-      # Rather than applying it to all targets and libraries, we here add it
-      # back to supported targets and libraries only.  This is needed for ELF
-      # targets only; however, RemoteMirror needs to build with undefined
-      # symbols.
-      if(${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF AND
-         NOT ${name} STREQUAL swiftRemoteMirror)
-        list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
-      endif()
-
-      # For each architecture supported by this SDK
-      foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
-        # Configure variables for this subdirectory.
-        set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
-        set(VARIANT_NAME "${name}${VARIANT_SUFFIX}")
-        set(MODULE_VARIANT_SUFFIX "-swiftmodule${VARIANT_SUFFIX}")
-        set(MODULE_VARIANT_NAME "${name}${MODULE_VARIANT_SUFFIX}")
-
-        # Map dependencies over to the appropriate variants.
-        set(swiftlib_link_libraries)
-        foreach(lib ${SWIFTLIB_LINK_LIBRARIES})
-          if(TARGET "${lib}${VARIANT_SUFFIX}")
-            list(APPEND swiftlib_link_libraries "${lib}${VARIANT_SUFFIX}")
-          else()
-            list(APPEND swiftlib_link_libraries "${lib}")
+      # Add this library variant.
+      _add_swift_library_single(
+        ${VARIANT_NAME}
+        ${name}
+        ${SWIFTLIB_SHARED_keyword}
+        ${SWIFTLIB_STATIC_keyword}
+        ${SWIFTLIB_OBJECT_LIBRARY_keyword}
+        ${SWIFTLIB_SOURCES}
+        MODULE_TARGET ${MODULE_VARIANT_NAME}
+        SDK ${sdk}
+        ARCHITECTURE ${arch}
+        DEPENDS ${SWIFTLIB_DEPENDS}
+        LINK_LIBRARIES ${swiftlib_link_libraries}
+        FRAMEWORK_DEPENDS ${swiftlib_framework_depends_flattened}
+        FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
+        LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
+        FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS} ${swiftlib_module_dependency_targets}
+        C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
+        SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all} ${swiftlib_swift_compile_private_frameworks_flag}
+        LINK_FLAGS ${swiftlib_link_flags_all}
+        PRIVATE_LINK_LIBRARIES ${swiftlib_private_link_libraries_targets}
+        INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}
+        INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY}
+        ${SWIFTLIB_DONT_EMBED_BITCODE_keyword}
+        ${SWIFTLIB_API_NOTES_NON_OVERLAY_keyword}
+        ${SWIFTLIB_IS_STDLIB_keyword}
+        ${SWIFTLIB_IS_STDLIB_CORE_keyword}
+        ${SWIFTLIB_IS_SDK_OVERLAY_keyword}
+        ${SWIFTLIB_TARGET_LIBRARY_keyword}
+        ${SWIFTLIB_FORCE_BUILD_FOR_HOST_SDK_keyword}
+        ${SWIFTLIB_FORCE_BUILD_OPTIMIZED_keyword}
+        ${SWIFTLIB_NOSWIFTRT_keyword}
+        INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
+        DEPLOYMENT_VERSION_OSX "${SWIFTLIB_DEPLOYMENT_VERSION_OSX}"
+        DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
+        DEPLOYMENT_VERSION_TVOS "${SWIFTLIB_DEPLOYMENT_VERSION_TVOS}"
+        DEPLOYMENT_VERSION_WATCHOS "${SWIFTLIB_DEPLOYMENT_VERSION_WATCHOS}"
+      )
+
+      if(NOT SWIFTLIB_OBJECT_LIBRARY)
+        # Add dependencies on the (not-yet-created) custom lipo target.
+        foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
+          if (NOT "${DEP}" STREQUAL "icucore")
+            add_dependencies(${VARIANT_NAME}
+              "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
           endif()
         endforeach()

-        # Swift compiles depend on swift modules, while links depend on
-        # linked libraries.  Find targets for both of these here.
-        set(swiftlib_module_dependency_targets)
-        set(swiftlib_private_link_libraries_targets)
-
-        if(NOT BUILD_STANDALONE)
-          foreach(mod ${swiftlib_module_depends_flattened})
-            list(APPEND swiftlib_module_dependency_targets
-                "swift${mod}${MODULE_VARIANT_SUFFIX}")
-
-            list(APPEND swiftlib_private_link_libraries_targets
-                "swift${mod}${VARIANT_SUFFIX}")
-          endforeach()
-        endif()
-
-        foreach(lib ${SWIFTLIB_PRIVATE_LINK_LIBRARIES})
-          if("${lib}" STREQUAL "ICU_UC")
-            list(APPEND swiftlib_private_link_libraries_targets
-                 "${SWIFT_${sdk}_${arch}_ICU_UC}")
-            # temporary fix for atomic needing to be
-            # after object files for libswiftCore.so
-            if("${sdk}" STREQUAL "ANDROID")
-              list(APPEND swiftlib_private_link_libraries_targets
-                   "-latomic")
-            # the same issue on FreeBSD, missing symbols:
-            # __atomic_store, __atomic_compare_exchange, __atomic_load
-            elseif("${sdk}" STREQUAL "FREEBSD")
-              list(APPEND swiftlib_private_link_libraries_targets
-                   "${SWIFTLIB_DIR}/clang/lib/freebsd/libclang_rt.builtins-${arch}.a")
-            endif()
-          elseif("${lib}" STREQUAL "ICU_I18N")
-            list(APPEND swiftlib_private_link_libraries_targets
-                 "${SWIFT_${sdk}_${arch}_ICU_I18N}")
-          elseif(TARGET "${lib}${VARIANT_SUFFIX}")
-            list(APPEND swiftlib_private_link_libraries_targets
-                "${lib}${VARIANT_SUFFIX}")
-          else()
-            list(APPEND swiftlib_private_link_libraries_targets "${lib}")
-          endif()
-        endforeach()
-
-        # Add PrivateFrameworks, rdar://28466433
-        if(SWIFTLIB_IS_SDK_OVERLAY)
-          set(swiftlib_swift_compile_private_frameworks_flag "-Fsystem" "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/System/Library/PrivateFrameworks/")
-        endif()
-
-        # Add this library variant.
-        _add_swift_library_single(
-          ${VARIANT_NAME}
-          ${name}
-          ${SWIFTLIB_SHARED_keyword}
-          ${SWIFTLIB_STATIC_keyword}
-          ${SWIFTLIB_OBJECT_LIBRARY_keyword}
-          ${SWIFTLIB_SOURCES}
-          MODULE_TARGET ${MODULE_VARIANT_NAME}
-          SDK ${sdk}
-          ARCHITECTURE ${arch}
-          DEPENDS ${SWIFTLIB_DEPENDS}
-          LINK_LIBRARIES ${swiftlib_link_libraries}
-          FRAMEWORK_DEPENDS ${swiftlib_framework_depends_flattened}
-          FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
-          LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
-          FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS} ${swiftlib_module_dependency_targets}
-          C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
-          SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all} ${swiftlib_swift_compile_private_frameworks_flag}
-          LINK_FLAGS ${swiftlib_link_flags_all}
-          PRIVATE_LINK_LIBRARIES ${swiftlib_private_link_libraries_targets}
-          INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}
-          INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY}
-          ${SWIFTLIB_DONT_EMBED_BITCODE_keyword}
-          ${SWIFTLIB_API_NOTES_NON_OVERLAY_keyword}
-          ${SWIFTLIB_IS_STDLIB_keyword}
-          ${SWIFTLIB_IS_STDLIB_CORE_keyword}
-          ${SWIFTLIB_IS_SDK_OVERLAY_keyword}
-          ${SWIFTLIB_TARGET_LIBRARY_keyword}
-          ${SWIFTLIB_FORCE_BUILD_FOR_HOST_SDK_keyword}
-          ${SWIFTLIB_FORCE_BUILD_OPTIMIZED_keyword}
-          ${SWIFTLIB_NOSWIFTRT_keyword}
-          INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
-          DEPLOYMENT_VERSION_OSX "${SWIFTLIB_DEPLOYMENT_VERSION_OSX}"
-          DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
-          DEPLOYMENT_VERSION_TVOS "${SWIFTLIB_DEPLOYMENT_VERSION_TVOS}"
-          DEPLOYMENT_VERSION_WATCHOS "${SWIFTLIB_DEPLOYMENT_VERSION_WATCHOS}"
-        )
-
-        if(NOT SWIFTLIB_OBJECT_LIBRARY)
+        if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
           # Add dependencies on the (not-yet-created) custom lipo target.
           foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
             if (NOT "${DEP}" STREQUAL "icucore")
-              add_dependencies(${VARIANT_NAME}
-                "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
+              add_dependencies("${VARIANT_NAME}-static"
+                "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
             endif()
           endforeach()
-
-          if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
-            # Add dependencies on the (not-yet-created) custom lipo target.
-            foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})
-              if (NOT "${DEP}" STREQUAL "icucore")
-                add_dependencies("${VARIANT_NAME}-static"
-                  "${DEP}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
-              endif()
-            endforeach()
-          endif()
-
-          # Note this thin library.
-          list(APPEND THIN_INPUT_TARGETS ${VARIANT_NAME})
         endif()
-      endforeach()
-
-      if(NOT SWIFTLIB_OBJECT_LIBRARY)
-        # Determine the name of the universal library.
-        if(SWIFTLIB_SHARED)
-          if("${sdk}" STREQUAL "WINDOWS")
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${name}.dll")
-          else()
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-          endif()
+
+        # Note this thin library.
+        list(APPEND THIN_INPUT_TARGETS ${VARIANT_NAME})
+      endif()
+    endforeach()
+
+    if(NOT SWIFTLIB_OBJECT_LIBRARY)
+      # Determine the name of the universal library.
+      if(SWIFTLIB_SHARED)
+        if("${sdk}" STREQUAL "WINDOWS")
+          set(UNIVERSAL_LIBRARY_NAME
+            "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${name}.dll")
         else()
-          if("${sdk}" STREQUAL "WINDOWS")
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${name}.lib")
-          else()
-            set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-          endif()
+          set(UNIVERSAL_LIBRARY_NAME
+            "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}")
         endif()
-
-        set(lipo_target "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
-        if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND SWIFTLIB_SHARED)
-          set(codesign_arg CODESIGN)
+      else()
+        if("${sdk}" STREQUAL "WINDOWS")
+          set(UNIVERSAL_LIBRARY_NAME
+            "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${name}.lib")
+        else()
+          set(UNIVERSAL_LIBRARY_NAME
+            "${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
         endif()
-        precondition(THIN_INPUT_TARGETS)
+      endif()
+
+      set(lipo_target "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
+      if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND SWIFTLIB_SHARED)
+        set(codesign_arg CODESIGN)
+      endif()
+      precondition(THIN_INPUT_TARGETS)
+      _add_swift_lipo_target(SDK
+                               ${sdk}
+                             TARGET
+                               ${lipo_target}
+                             OUTPUT
+                               ${UNIVERSAL_LIBRARY_NAME}
+                             ${codesign_arg}
+                             ${THIN_INPUT_TARGETS})
+
+      # Cache universal libraries for dependency purposes
+      set(UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}
+        ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}}
+        ${lipo_target}
+        CACHE INTERNAL "UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
+
+      # Determine the subdirectory where this library will be installed.
+      set(resource_dir_sdk_subdir "${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
+      precondition(resource_dir_sdk_subdir)
+
+      if(SWIFTLIB_SHARED)
+        set(resource_dir "swift")
+        set(file_permissions
+            OWNER_READ OWNER_WRITE OWNER_EXECUTE
+            GROUP_READ GROUP_EXECUTE
+            WORLD_READ WORLD_EXECUTE)
+      else()
+        set(resource_dir "swift_static")
+        set(file_permissions
+            OWNER_READ OWNER_WRITE
+            GROUP_READ
+            WORLD_READ)
+      endif()
+
+      swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
+          FILES "${UNIVERSAL_LIBRARY_NAME}"
+          DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
+          PERMISSIONS ${file_permissions})
+      swift_is_installing_component("${SWIFTLIB_INSTALL_IN_COMPONENT}" is_installing)
+
+      if(NOT is_installing)
+        set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${VARIANT_NAME})
+      else()
+        set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${VARIANT_NAME})
+      endif()
+
+      # If we built static variants of the library, create a lipo target for
+      # them.
+      set(lipo_target_static)
+      if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
+        set(THIN_INPUT_TARGETS_STATIC)
+        foreach(TARGET ${THIN_INPUT_TARGETS})
+          list(APPEND THIN_INPUT_TARGETS_STATIC "${TARGET}-static")
+        endforeach()
+
+        set(lipo_target_static
+            "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
+        set(UNIVERSAL_LIBRARY_NAME
+            "${SWIFTSTATICLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
         _add_swift_lipo_target(SDK
                                  ${sdk}
                                TARGET
-                                 ${lipo_target}
+                                 ${lipo_target_static}
                                OUTPUT
-                                 ${UNIVERSAL_LIBRARY_NAME}
-                               ${codesign_arg}
-                               ${THIN_INPUT_TARGETS})
-
-        # Cache universal libraries for dependency purposes
-        set(UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}
-          ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}}
-          ${lipo_target}
-          CACHE INTERNAL "UNIVERSAL_LIBRARY_NAMES_${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
-
-        # Determine the subdirectory where this library will be installed.
-        set(resource_dir_sdk_subdir "${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
-        precondition(resource_dir_sdk_subdir)
-
-        if(SWIFTLIB_SHARED)
-          set(resource_dir "swift")
-          set(file_permissions
-              OWNER_READ OWNER_WRITE OWNER_EXECUTE
-              GROUP_READ GROUP_EXECUTE
-              WORLD_READ WORLD_EXECUTE)
-        else()
-          set(resource_dir "swift_static")
-          set(file_permissions
+                                 "${UNIVERSAL_LIBRARY_NAME}"
+                               ${THIN_INPUT_TARGETS_STATIC})
+        swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
+            FILES "${UNIVERSAL_LIBRARY_NAME}"
+            DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift_static/${resource_dir_sdk_subdir}"
+            PERMISSIONS
               OWNER_READ OWNER_WRITE
               GROUP_READ
               WORLD_READ)
-        endif()
-
-        swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
-            FILES "${UNIVERSAL_LIBRARY_NAME}"
-            DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
-            PERMISSIONS ${file_permissions})
-        swift_is_installing_component("${SWIFTLIB_INSTALL_IN_COMPONENT}" is_installing)
-
-        if(NOT is_installing)
-          set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${VARIANT_NAME})
-        else()
-          set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${VARIANT_NAME})
-        endif()
-
-        # If we built static variants of the library, create a lipo target for
-        # them.
-        set(lipo_target_static)
-        if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
-          set(THIN_INPUT_TARGETS_STATIC)
-          foreach(TARGET ${THIN_INPUT_TARGETS})
-            list(APPEND THIN_INPUT_TARGETS_STATIC "${TARGET}-static")
-          endforeach()
-
-          set(lipo_target_static
-              "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-static")
-          set(UNIVERSAL_LIBRARY_NAME
-              "${SWIFTSTATICLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-          _add_swift_lipo_target(SDK
-                                   ${sdk}
-                                 TARGET
-                                   ${lipo_target_static}
-                                 OUTPUT
-                                   "${UNIVERSAL_LIBRARY_NAME}"
-                                 ${THIN_INPUT_TARGETS_STATIC})
-          swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
-              FILES "${UNIVERSAL_LIBRARY_NAME}"
-              DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift_static/${resource_dir_sdk_subdir}"
-              PERMISSIONS
-                OWNER_READ OWNER_WRITE
-                GROUP_READ
-                WORLD_READ)
-        endif()
-
-        # Add Swift standard library targets as dependencies to the top-level
-        # convenience target.
-        set(FILTERED_UNITTESTS
-              swiftStdlibCollectionUnittest
-              swiftStdlibUnicodeUnittest)
-
-        foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
-          set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
-          if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND
-             TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
-            add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
+      endif()
+
+      # Add Swift standard library targets as dependencies to the top-level
+      # convenience target.
+      set(FILTERED_UNITTESTS
+            swiftStdlibCollectionUnittest
+            swiftStdlibUnicodeUnittest)
+
+      foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
+        set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
+        if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND
+           TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
+          add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
+              ${lipo_target}
+              ${lipo_target_static})
+          if(NOT "${name}" IN_LIST FILTERED_UNITTESTS)
+            add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
                 ${lipo_target}
                 ${lipo_target_static})
-            if(NOT "${name}" IN_LIST FILTERED_UNITTESTS)
-              add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
-                  ${lipo_target}
-                  ${lipo_target_static})
-            endif()
           endif()
-        endforeach()
-      endif()
-    endforeach()
-  else()
-    set(sdk "${SWIFT_HOST_VARIANT_SDK}")
-    set(arch "${SWIFT_HOST_VARIANT_ARCH}")
-
-    # Collect compiler flags
-    set(swiftlib_swift_compile_flags_all ${SWIFTLIB_SWIFT_COMPILE_FLAGS})
-    if("${sdk}" STREQUAL "OSX")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_OSX})
-    elseif("${sdk}" STREQUAL "IOS" OR "${sdk}" STREQUAL "IOS_SIMULATOR")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_IOS})
-    elseif("${sdk}" STREQUAL "TVOS" OR "${sdk}" STREQUAL "TVOS_SIMULATOR")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_TVOS})
-    elseif("${sdk}" STREQUAL "WATCHOS" OR "${sdk}" STREQUAL "WATCHOS_SIMULATOR")
-      list(APPEND swiftlib_swift_compile_flags_all
-        ${SWIFTLIB_SWIFT_COMPILE_FLAGS_WATCHOS})
-    endif()
-
-    _add_swift_library_single(
-      ${name}
-      ${name}
-      ${SWIFTLIB_SHARED_keyword}
-      ${SWIFTLIB_STATIC_keyword}
-      ${SWIFTLIB_OBJECT_LIBRARY_keyword}
-      ${SWIFTLIB_SOURCES}
-      SDK ${sdk}
-      ARCHITECTURE ${arch}
-      DEPENDS ${SWIFTLIB_DEPENDS}
-      LINK_LIBRARIES ${SWIFTLIB_LINK_LIBRARIES}
-      FRAMEWORK_DEPENDS ${SWIFTLIB_FRAMEWORK_DEPENDS}
-      FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
-      LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
-      FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS}
-      C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
-      SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all}
-      LINK_FLAGS ${SWIFTLIB_LINK_FLAGS}
-      PRIVATE_LINK_LIBRARIES ${SWIFTLIB_PRIVATE_LINK_LIBRARIES}
-      INTERFACE_LINK_LIBRARIES ${SWIFTLIB_INTERFACE_LINK_LIBRARIES}
-      INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}
-      INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY}
-      ${SWIFTLIB_DONT_EMBED_BITCODE_keyword}
-      ${SWIFTLIB_API_NOTES_NON_OVERLAY_keyword}
-      ${SWIFTLIB_IS_STDLIB_keyword}
-      ${SWIFTLIB_IS_STDLIB_CORE_keyword}
-      ${SWIFTLIB_IS_SDK_OVERLAY_keyword}
-      INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
-      DEPLOYMENT_VERSION_OSX "${SWIFTLIB_DEPLOYMENT_VERSION_OSX}"
-      DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
-      DEPLOYMENT_VERSION_TVOS "${SWIFTLIB_DEPLOYMENT_VERSION_TVOS}"
-      DEPLOYMENT_VERSION_WATCHOS "${SWIFTLIB_DEPLOYMENT_VERSION_WATCHOS}"
-      )
-
-      swift_install_in_component(dev
-          TARGETS ${name}
-          ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-          LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-          RUNTIME DESTINATION bin)
-      swift_is_installing_component(dev is_installing)
-
-      if(NOT is_installing)
-        set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${name})
-      else()
-        set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${name})
-      endif()
-  endif()
-
-  precondition(SWIFTLIB_TARGET_LIBRARY
-    MESSAGE "TARGET_LIBRARY not inferred in add_swift_target_library?!")
+        endif()
+      endforeach()
+    endif()
+  endforeach()
 endfunction()

 # Add an executable compiled for a given variant.


[cmake] Force the linker_language of host executables to be CXX.

In certain cases our executables are going to have a mix of cxx,swift. There are
current issues when linking cxx,swift code with swiftc itself, so this lets us
avoid that problem.

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -572,6 +572,9 @@
   _add_host_variant_c_compile_link_flags(${executable})
   target_link_directories(${executable} PRIVATE
     ${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
+  # Force executables linker language to be CXX so that we do not link using the
+  # host toolchain swiftc.
+  set_target_properties(${executable} PROPERTIES LINKER_LANGUAGE CXX)
   add_dependencies(${executable} ${LLVM_COMMON_DEPENDS})

   set_target_properties(${executable} PROPERTIES


[CMake] Do announce that C++17 is required when compiling againss `rawspeed` target headers

--- cmake/src-dependencies.cmake
+++ cmake/src-dependencies.cmake
@@ -15,6 +15,8 @@

   add_dependencies(dependencies benchmark)
 endif()
+
+target_compile_features(rawspeed PUBLIC cxx_std_17)

 unset(HAVE_OPENMP)
 if(WITH_OPENMP)


cmake 3.12 [ci skip]

cmake 3.12 [ci skip]


ENH: Update default version of VTK from 5 to 6

--- SuperBuild/External_VTK.cmake
+++ SuperBuild/External_VTK.cmake
@@ -26,7 +26,7 @@

 #Setting VTK_VERSION_MAJOR to its default value if it has not been set before
-set(VTK_VERSION_MAJOR 5 CACHE STRING "Choose the expected VTK major version to build Slicer (5 or 6).")
+set(VTK_VERSION_MAJOR 6 CACHE STRING "Choose the expected VTK major version to build Slicer (5 or 6).")
 # Set the possible values of VTK major version for cmake-gui
 set_property(CACHE VTK_VERSION_MAJOR PROPERTY STRINGS "5" "6")
 if(NOT "${VTK_VERSION_MAJOR}" STREQUAL "5" AND NOT "${VTK_VERSION_MAJOR}" STREQUAL "6")


Use proper coverage flags according to the compiler

--- tools/cmake/SpecialtyBuilds.cmake
+++ tools/cmake/SpecialtyBuilds.cmake
@@ -7,7 +7,10 @@
         message(FATAL_ERROR
                 "Code coverage is not yet supported on Visual Studio builds")
     else()
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage -fno-inline -fno-elide-constructors")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage -fno-elide-constructors")
+        if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-inline -fno-inline-small-functions -fno-default-inline")
+        endif()
     endif()
 endif()

@@ -85,4 +88,4 @@
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer -O2 -g -fPIE -pie")
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
     endif()
-endif()+endif()


STYLE: Fixing spacing around ( and )

STYLE: Fixing spacing around ( and )

--- CMake/TubeTKCheckPythonLibrary.cmake
+++ CMake/TubeTKCheckPythonLibrary.cmake
@@ -39,48 +39,52 @@

 include(CMakeParseArguments)

-macro(TubeTKCheckPythonLibrary library)
-  set(${library}_ERROR TRUE)
-  set(${library}_FOUND FALSE)
+macro( TubeTKCheckPythonLibrary library )
+  set( ${library}_ERROR TRUE )
+  set( ${library}_FOUND FALSE )
   #Sanity check: Make sure only one library name is given
-  if(${ARGC} EQUAL 1)
-    set(list_var "${ARGN}")
-    find_package(PythonInterp REQUIRED)
+  if( ${ARGC} EQUAL 1 )
+    set( list_var "${ARGN}" )
+    find_package( PythonInterp REQUIRED )

     execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
       "exec(\"import sys\\ntry:\\n  import ${library}\\nexcept Exception as e:\\n  print(e)\\n  sys.exit(0)\\nsys.exit(1)\")"
       RESULT_VARIABLE ${library}_FOUND
       OUTPUT_VARIABLE _PYTHON_VALUES
       ERROR_VARIABLE _PYTHON_ERROR_VALUE
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    set(${library}_ERROR FALSE)
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+      )
+    set( ${library}_ERROR FALSE )
   endif()
 endmacro()

-macro(TubeTKCheckPythonLibraries)
-  set(options REQUIRED)
-  set(oneValueArgs ERROR_MESSAGE)
-  set(multiValueArgs LIBRARIES)
-  cmake_parse_arguments(CheckLibraries "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
-   if(CheckLibraries_UNPARSED_ARGUMENTS)
-    message(AUTHOR_WARNING "Unparsed arguments given [${CheckLibraries_UNPARSED_ARGUMENTS}]")
+macro( TubeTKCheckPythonLibraries )
+  set( options REQUIRED )
+  set( oneValueArgs ERROR_MESSAGE )
+  set( multiValueArgs LIBRARIES )
+  cmake_parse_arguments( CheckLibraries "${options}" "${oneValueArgs}"
+    "${multiValueArgs}" ${ARGN} )
+  if( CheckLibraries_UNPARSED_ARGUMENTS )
+    message( AUTHOR_WARNING
+      "Unparsed arguments given [${CheckLibraries_UNPARSED_ARGUMENTS}]" )
   endif()
-  if(NOT DEFINED CheckLibraries_LIBRARIES)
-    message(AUTHOR_WARNING "LIBRARIES are mandatory: [${CheckLibraries_LIBRARIES}]")
+  if( NOT DEFINED CheckLibraries_LIBRARIES )
+    message( AUTHOR_WARNING
+      "LIBRARIES are mandatory: [${CheckLibraries_LIBRARIES}]" )
   endif()
-  find_package(PythonInterp)
-  if(NOT PythonInterp_FOUND)
-    if(CheckLibraries_REQUIRED)
-      message(FATAL_ERROR
-        "Python interpreter was not found. ${CheckLibraries_ERROR_MESSAGE}")
+  find_package( PythonInterp )
+  if( NOT PythonInterp_FOUND AND NOT PYTHONINTERP_FOUND )
+    if( CheckLibraries_REQUIRED )
+      message( FATAL_ERROR
+        "Python interpreter was not found. ${CheckLibraries_ERROR_MESSAGE}" )
     endif()
   else()
-    foreach(var ${CheckLibraries_LIBRARIES})
-      TubeTKCheckPythonLibrary(${var})
+    foreach( var ${CheckLibraries_LIBRARIES} )
+      TubeTKCheckPythonLibrary( ${var} )
       if( NOT ${var}_FOUND )
-        if(CheckLibraries_REQUIRED)
-          message(FATAL_ERROR
-            "${var} was not found. ${CheckLibraries_ERROR_MESSAGE}")
+        if( CheckLibraries_REQUIRED )
+          message( FATAL_ERROR
+            "${var} was not found. ${CheckLibraries_ERROR_MESSAGE}" )
         endif()
       endif()
     endforeach()


simple build fix for linux systems with glib1 installed -- thanks to kazzy

git-svn-id: 65dd0ccd495961f396d5302e5521154b071f0302@2484 5b2332b8-efa3-11de-8684-7d64432d61a3

--- CMakeModules/ConfigurePackages.cmake
+++ CMakeModules/ConfigurePackages.cmake
@@ -261,7 +261,7 @@

 macro (configure_glib)
     sagase_configure_package (GLIB
-        NAMES glib Glib
+        NAMES glib-2.0 glib Glib
         COMPONENTS glib-2.0 gobject-2.0 glib # glib added to help sagese to find include folder with glib.h file
         PREFIXES ${ENV_NAALI_DEP_PATH})
     sagase_configure_report (GLIB)


[FIX] VS builds: Disabling parallel_queue demo due to bug in vc++ compiler.

--- util/cmake/SeqAnBuildSystem.cmake
+++ util/cmake/SeqAnBuildSystem.cmake
@@ -665,6 +665,10 @@
                 _seqan_setup_demo_test (${ENTRY} ${PREFIX}${BIN_NAME})
             endif ()
         else ()
+            if ("${FILE_NAME}" MATCHES "queue_example.cpp" AND COMPILER_IS_MSVC)
+                message(STATUS "Not building demo ${FILE_NAME} under visual studio." )
+                continue()
+            endif ()
             add_executable(${PREFIX}${BIN_NAME} ${ENTRY})
             target_link_libraries (${PREFIX}${BIN_NAME} ${SEQAN_LIBRARIES})
             _seqan_setup_demo_test (${ENTRY} ${PREFIX}${BIN_NAME})


BUG: missing patch source macro for CURL

--- SuperBuild/CMake/External_curl.cmake
+++ SuperBuild/CMake/External_curl.cmake
@@ -53,3 +53,5 @@
   LOG_BUILD 1
   LOG_INSTALL 1
   )
+
+SUPERBUILD_PATCH_SOURCE(CURL)


SuperBuild: add jpeg variables for HDF4

SuperBuild: add jpeg variables for HDF4

--- SuperBuild/CMake/External_jpeg.cmake
+++ SuperBuild/CMake/External_jpeg.cmake
@@ -61,3 +61,10 @@
 SUPERBUILD_PATCH_SOURCE(JPEG)

 SUPERBUILD_UPDATE_CMAKE_VARIABLES(JPEG FALSE)
+
+set(_SB_JPEGLIB_H_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
+if(WIN32)
+  set(_SB_JPEG_LIB ${SB_INSTALL_PREFIX}/lib/jpeg_i.lib)
+elseif(UNIX)
+  set(_SB_JPEG_LIB ${SB_INSTALL_PREFIX}/lib/libjpeg${CMAKE_SHARED_LIBRARY_SUFFIX})
+endif()


COMP: Bump KWStyle to address Boost warnings with GCC 11.2

--- Utilities/KWStyle/BuildKWStyle.cmake
+++ Utilities/KWStyle/BuildKWStyle.cmake
@@ -23,7 +23,7 @@
 if(NOT TARGET KWStyle)
 ExternalProject_add(KWStyle
   GIT_REPOSITORY "${git_protocol}://github.com/Kitware/KWStyle.git"
-  GIT_TAG c7b8a63d18ddf7e14e61874e430509c6d96c191d
+  GIT_TAG aeb0914947df4cae8ceeab1415e99ceb64acda35
   UPDATE_COMMAND ""
   DOWNLOAD_DIR ${KWStyle_SOURCE_DIR}
   SOURCE_DIR ${KWStyle_SOURCE_DIR}


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   16)
+SET(KWSYS_DATE_STAMP_DAY   17)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 04)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   14)
+SET(KWSYS_DATE_STAMP_DAY   15)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 07)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   05)
+SET(KWSYS_DATE_STAMP_DAY   06)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 06)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   12)
+SET(KWSYS_DATE_STAMP_DAY   13)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 09)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   18)
+SET(KWSYS_DATE_STAMP_DAY   19)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 08)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   15)
+SET(KWSYS_DATE_STAMP_DAY   16)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 01)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   11)
+SET(KWSYS_DATE_STAMP_DAY   12)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   07)
+SET(KWSYS_DATE_STAMP_DAY   08)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 03)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   19)
+SET(KWSYS_DATE_STAMP_DAY   20)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 12)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   01)
+SET(KWSYS_DATE_STAMP_DAY   02)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 02)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   22)
+SET(KWSYS_DATE_STAMP_DAY   23)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   22)
+SET(KWSYS_DATE_STAMP_DAY   23)


Apply fix in https://root.cern.ch/phpBB3/viewtopic.php?f=3&t=20708

--- graf2d/asimage/BuildAfterImage.cmake
+++ graf2d/asimage/BuildAfterImage.cmake
@@ -31,7 +31,7 @@

   set(AFTER_CC ${CMAKE_C_COMPILER})
   set(AFTER_CFLAGS "-O")
-  if(CMAKE_C_COMPILER MATCHES icc)
+  if(CMAKE_C_COMPILER_ID MATCHES Intel)
     set(AFTER_CFLAGS "${AFTER_CFLAGS} -wd188 -wd869 -wd2259 -wd1418 -wd1419 -wd593 -wd981 -wd1599 -wd181 -wd177 -wd1572")
   endif()
   if(ROOT_ARCHITECTURE MATCHES linuxx8664icc)


Include libexpat.so.1 in the list of libs to copy.

--- indra/cmake/Copy3rdPartyLibs.cmake
+++ indra/cmake/Copy3rdPartyLibs.cmake
@@ -221,6 +221,7 @@
         libcrypto.so.0.9.7
         libdb-4.2.so
         libexpat.so
+        libexpat.so.1
         libgmock_main.so
         libgmock.so.0
         libgmodule-2.0.so


COMP: fix DTIProcess windows compilation errors

--- CMake/FindExternalTools.cmake
+++ CMake/FindExternalTools.cmake
@@ -262,7 +262,7 @@
 if(RecompileBatchMake)
     ExternalProject_Add(BatchMake
       GIT_REPOSITORY ${git_protocol}://batchmake.org/BatchMake.git
-      GIT_TAG "0abb2faca1251f808ab3d0b820cc27b570a994f1" # 08-26-2012 updated for ITKv4 # "43d21fcccd09e5a12497bc1fb924bc6d5718f98c" # used in DTI-Reg 12-21-2012
+      GIT_TAG "8addbdb62f0135ba01ffe12ddfc32121b6d66ef5" # 01-30-2013 # "0abb2faca1251f808ab3d0b820cc27b570a994f1" # 08-26-2012 updated for ITKv4 # "43d21fcccd09e5a12497bc1fb924bc6d5718f98c" # used in DTI-Reg 12-21-2012
       SOURCE_DIR BatchMake
       BINARY_DIR BatchMake-build
       CMAKE_GENERATOR ${gen}
@@ -321,10 +321,10 @@

 # ===== dtiprocessTK ==============================================================
 set( SourceCodeArgs
-  SVN_REPOSITORY "http://www.nitrc.org/svn/dtiprocess/branches/Slicer4Extension"#/dtiprocess"
+  SVN_REPOSITORY "http://www.nitrc.org/svn/dtiprocess/branches/Slicer4Extension" # /dtiprocess"
   SVN_USERNAME slicerbot
   SVN_PASSWORD slicer
-  SVN_REVISION -r 137 # 01/16/2013 # 113 # 12/20/2012 updated for ITKv4.3.0
+  SVN_REVISION -r 144 # 01/30/2013 version modified by Adrien for windows compilation # 137 # 01/16/2013 # 113 # 12/20/2012 updated for ITKv4.3.0
   )
 set( CMAKE_ExtraARGS
   -DBUILD_TESTING:BOOL=OFF


Update test data hash

Update test data hash

--- CMakeExternals/MITKData.cmake
+++ CMakeExternals/MITKData.cmake
@@ -13,7 +13,7 @@

 if(BUILD_TESTING)

-  set(revision_tag 91a6bd5e) # first 8 characters of hash-tag
+  set(revision_tag 6001ab9c) # first 8 characters of hash-tag
 #                  ^^^^^^^^  these are just to check correct length of hash part

   ExternalProject_Add(${proj}


COMP Updated MITK-Data

COMP Updated MITK-Data

--- CMakeExternals/MITKData.cmake
+++ CMakeExternals/MITKData.cmake
@@ -13,7 +13,7 @@

 if(BUILD_TESTING)

-  set(revision_tag f04939c6) # first 8 characters of hash-tag
+  set(revision_tag 15387de2) # first 8 characters of hash-tag
 #                  ^^^^^^^^  these are just to check correct length of hash part

   ExternalProject_Add(${proj}


FindFFTW3.cmake: use inferred version on msvc

--- cmake/FindFFTW3.cmake
+++ cmake/FindFFTW3.cmake
@@ -55,6 +55,7 @@
 		PATHS ${_subdirs}
 		PATH_SUFFIXES include fftw3 include/fftw3)

+	set(FFTW3_VERSION "3.${FFTW3_VERSION_MINOR}")
 else ()
 	find_package(PkgConfig)
 	pkg_check_modules(PC_FFTW3F QUIET fftw3f)


Make Aruco an optional requirement. Findaruco.cmake warns about not finding Aruco instead of raising error.

--- cmake/Findaruco.cmake
+++ cmake/Findaruco.cmake
@@ -19,4 +19,4 @@
 #      - aruco_VERSION_PATCH : Patch version part of VERSION. Example: "0"
 #
 # ===================================================================================
-message(FATAL_ERROR "Error: Replace the file rgbd_rtk/cmake/Findaruco.cmake by the one generated by the compilation of ARUCO in your machine.")
+message(WARNING "Aruco is required for the SLAM module. To find Aruco, replace the file rgbd_rtk/cmake/Findaruco.cmake by the one generated after compiling Aruco in your machine.")


UseCyclus now get CPP variable

UseCyclus now get CPP variable

--- cmake/UseCyclus.cmake
+++ cmake/UseCyclus.cmake
@@ -89,11 +89,15 @@

     # set cpp path
-    IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-        SET(PREPROCESSOR "--cpp-path=clang++")
+
+    IF(DEFINED ENV{CPP})
+        SET(SYS_CPP "ENV{CPP}")
+    ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+        SET(SYS_CPP "clang++")
     ELSE()
-        SET(PREPROCESSOR "--cpp-path=cpp")
+        SET(SYS_CPP "cpp")
     ENDIF()
+    SET(PREPROCESSOR "--cpp-path=${SYS_CPP}")

     # copy custom headers
     FOREACH(fname ${CYCLUS_CUSTOM_HEADERS})


Fix CMake error on some systems (#118)

Fix CMake error on some systems (#118)

Resolves #117

--- cmake/WaveUtils.cmake
+++ cmake/WaveUtils.cmake
@@ -1,5 +1,7 @@
 # - Macros used in libwave
-#
+
+INCLUDE(CMakeParseArguments)
+
 # wave_add_test: Add a gtest target
 #
 # WAVE_ADD_TEST(Name [DISABLED] src1 [src2...])


Fix InitializeNativeTargetAsmParser in CMake builds by defining the
appropriate macro. Patch by Alexey Prokhin. Fixes PR11498.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@146239 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -332,6 +332,11 @@
   set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo)
   set(LLVM_NATIVE_TARGETMC LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC)
   set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter)
+
+  # We don't have an ASM parser for all architectures yet.
+  if (EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/CMakeLists.txt)
+    set(LLVM_NATIVE_ASMPARSER LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser)
+  endif ()
 endif ()

 if( MINGW )


Revert "Enable ASAN build and test on AArch64"

This reverts commit r229665. It seems that the AArch64 ASAN tests, that
pass on all our internal machines, doesn't like the public buildbot.

Turning this off until we can investigate the public bot for a better
understanding.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@229739 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -197,7 +197,7 @@
 filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
   x86_64 i386 i686 powerpc64 powerpc64le arm aarch64 mips mips64 mipsel mips64el)
 filter_available_targets(ASAN_SUPPORTED_ARCH
-  x86_64 i386 i686 powerpc64 powerpc64le arm aarch64 mips mipsel mips64 mips64el)
+  x86_64 i386 i686 powerpc64 powerpc64le arm mips mipsel mips64 mips64el)
 filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
 filter_available_targets(LSAN_SUPPORTED_ARCH x86_64)
 # LSan common files should be available on all architectures supported


[CMake] Add -fvisibility-inlines-hidden if the compiler supports it.

This results in a significant reduction in the size of the sanitizer libraries.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@254308 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -29,6 +29,12 @@
 check_cxx_compiler_flag(-fno-lto             COMPILER_RT_HAS_FNO_LTO_FLAG)
 check_cxx_compiler_flag(-msse3               COMPILER_RT_HAS_MSSE3_FLAG)
 check_cxx_compiler_flag(-std=c99             COMPILER_RT_HAS_STD_C99_FLAG)
+
+if(NOT WIN32 AND NOT CYGWIN)
+  # MinGW warns if -fvisibility-inlines-hidden is used.
+  check_cxx_compiler_flag("-fvisibility-inlines-hidden" COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG)
+  append_string_if(COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG "-fvisibility-inlines-hidden" CMAKE_CXX_FLAGS)
+endif()

 check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
 check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)


Use pkg-config variables for yaml-cpp. (#84)

Related to googlecartographer/cartographer_ros#117.

--- cmake/functions.cmake
+++ cmake/functions.cmake
@@ -104,7 +104,9 @@
   endif()

   if(ARG_USES_YAMLCPP)
-    target_link_libraries("${NAME}" yaml-cpp)
+    target_include_directories("${NAME}" SYSTEM ${VISIBILITY}
+      "${YAMLCPP_INCLUDE_DIRS}")
+    target_link_libraries("${NAME}" ${YAMLCPP_LIBRARIES})
   endif()

   if(ARG_USES_CAIRO)


better pardiso lookup

better pardiso lookup

git-svn-id: 6b1c4fe79111c0bc0cce83313250759594f8984b@5807 e128ff1e-fa79-4151-a8cb-522299a2c450

--- cmake/gsLibrary.cmake
+++ cmake/gsLibrary.cmake
@@ -114,6 +114,11 @@
   LABELS ${PROJECT_NAME}
   )

+  if (MKL_FOUND)
+    # See http://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html
+    target_link_libraries(${PROJECT_NAME} ${MKL_LIBRARIES})
+  endif(MKL_FOUND)
+
   IF (GISMO_EXTRA_DEBUG AND DBGHELP_FOUND)
      TARGET_LINK_LIBRARIES(${PROJECT_NAME}_static ${DBGHELP_LIBRARY})
   ENDIF()


clean up the main CMakeLists.txt

clean up the main CMakeLists.txt

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@2798 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/pcl_cpack.cmake
+++ cmake/pcl_cpack.cmake
@@ -8,6 +8,12 @@
 #if(EXISTS ${RPM_PROGRAM})
 #  list(APPEND CPACK_GENERATOR "RPM")
 #endif(EXISTS ${RPM_PROGRAM})
+
+set(CPACK_PACKAGE_VERSION "${PCL_VERSION}")
+set(CPACK_PACKAGE_VERSION_MAJOR "${PCL_MAJOR_VERSION}")
+set(CPACK_PACKAGE_VERSION_MINOR "${PCL_MINOR_VERSION}")
+set(CPACK_PACKAGE_VERSION_PATCH "${PCL_REVISION_VERSION}")
+set(CPACK_PACKAGE_CONFIG_INSTALL_DIR ${PCLCONFIG_INSTALL_DIR})

 # DEB
 if("${CMAKE_SYSTEM}" MATCHES "Linux")
@@ -23,6 +29,18 @@
   if(EXISTS ${NSIS_PROGRAM})
     list(APPEND CPACK_GENERATOR "NSIS")
   endif(EXISTS ${NSIS_PROGRAM})
+  if(CMAKE_CL_64)
+    set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
+    set(win_system_name win64)
+  else(CMAKE_CL_64)
+    set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES32")
+    set(win_system_name win32)
+  endif(CMAKE_CL_64)
+  set(CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME}-${PCL_VERSION}-${win_system_name}")
+  # force CPACK_PACKAGE_INSTALL_REGISTRY_KEY because of a known limitation in cmake/cpack to be fixed in next releases
+  # http://public.kitware.com/Bug/view.php?id=9094
+  # This is to allow a 32bit and a 64bit of PCL to get installed on one system
+  set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME} ${PCL_VERSION} ${win_system_name}" )
 endif()

 # dpkg


[numerics] set SICONOS_DPARAM_LSA_ALPHA_MIN to 0.0 to pass tests

--- numerics/numerics_tests.cmake
+++ numerics/numerics_tests.cmake
@@ -651,13 +651,17 @@
     WILL_FAIL)
   NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat SICONOS_FRICTION_3D_NSN_AC 1e-5 5000
     0 0 0
-    IPARAM 1 1)
+    IPARAM 1 1)
    NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat SICONOS_FRICTION_3D_NSN_AC_TEST 1e-5 500
     0 0 0
-    IPARAM 1 1)
+    IPARAM 1 1
+    DPARAM SICONOS_DPARAM_LSA_ALPHA_MIN 0.0) # alpha_min needs to be equal to zero for convergence

   NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat SICONOS_FRICTION_3D_NSN_AC 1e-3 1000)
-  NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat SICONOS_FRICTION_3D_NSN_AC_TEST 1e-3 1000)
+  NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat SICONOS_FRICTION_3D_NSN_AC_TEST 1e-3 1000
+    0 0 0
+    DPARAM SICONOS_DPARAM_LSA_ALPHA_MIN 0.0) # alpha_min needs to be equal to zero for convergence
+
   NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat SICONOS_FRICTION_3D_NSN_FB 1e-3 1000)
   NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat SICONOS_FRICTION_3D_NSN_NM 1e-3 1000)
   NEW_FC_3D_TEST(BoxesStack1-i100000-32.hdf5.dat


Fix detection of "std" flag in CMAKE_CXX_FLAGS

re-ordered the loop so that the "std" flag did not have to be the last
one to be detected.

--- CMake/sitkCheckRequiredFlags.cmake
+++ CMake/sitkCheckRequiredFlags.cmake
@@ -56,11 +56,13 @@
   "^-std=" # required to be last
 )

-foreach(f ${cmake_cxx_flags_list})
-  foreach( _r ${required_flags_regex_to_test} )
-    string(REGEX MATCH  ${_r} _HAS_FLAG ${f} )
-    if (_HAS_FLAG )
+foreach( _r ${required_flags_regex_to_test} )
+  set(_HAS_FLAG 0)
+  foreach(f ${cmake_cxx_flags_list})
+    string(REGEX MATCH  ${_r} _match ${f} )
+    if (_match )
       list(APPEND SimpleITK_PUBLIC_COMPILE_OPTIONS ${f})
+      set(_HAS_FLAG ${_match})
     endif()
   endforeach()
 endforeach()


ENH: Disable style check

ENH: Disable style check


Fix propogation bug.

Fix propogation bug.

--- CPM.cmake
+++ CPM.cmake
@@ -441,7 +441,7 @@
   # propogate the versioning information up again to it's parent's namespace.
   if (NOT CPM_HIERARCHY_LEVEL EQUAL 0)
     foreach(_cpm_kvName IN LISTS CPM_KV_LIST_INCLUDE_MAP)
-      set(${_cpm_kvName} ${CPM_KV_INCLUDE_MAP_${_cpm_kvName}} PARENT_SCOPE)
+      set(CPM_KV_INCLUDE_MAP_${_cpm_kvName} ${CPM_KV_INCLUDE_MAP_${_cpm_kvName}} PARENT_SCOPE)
     endforeach()
     set(_cpm_kvName) # Clear kvName

@@ -457,7 +457,7 @@
   # propogate the versioning information up again to it's parent's namespace.
   if (NOT CPM_HIERARCHY_LEVEL EQUAL 0)
     foreach(_cpm_kvName IN LISTS CPM_KV_LIST_DEFINITION_MAP)
-      set(${_cpm_kvName} ${CPM_KV_DEFINITION_MAP_${_cpm_kvName}} PARENT_SCOPE)
+      set(CPM_KV_DEFINITION_MAP_${_cpm_kvName} ${CPM_KV_DEFINITION_MAP_${_cpm_kvName}} PARENT_SCOPE)
     endforeach()
     set(_cpm_kvName) # Clear kvName

@@ -473,7 +473,7 @@
   # propogate the versioning information up again to it's parent's namespace.
   if (NOT CPM_HIERARCHY_LEVEL EQUAL 0)
     foreach(_cpm_kvName IN LISTS CPM_KV_LIST_EXPORT_MAP)
-      set(${_cpm_kvName} ${CPM_KV_EXPORT_MAP_${_cpm_kvName}} PARENT_SCOPE)
+      set(CPM_KV_EXPORT_MAP_${_cpm_kvName} ${CPM_KV_EXPORT_MAP_${_cpm_kvName}} PARENT_SCOPE)
     endforeach()
     set(_cpm_kvName) # Clear kvName

@@ -933,7 +933,7 @@

     # Add the preprocessor definition to our list of definitions.
     _cpm_build_preproc_name(${CPM_LAST_MODULE_NAME} __CPM_LAST_MODULE_PREPROC)
-    set(${DEFINITION_MAP_NAME} ${${DEFINITION_MAP_NAME}} "-D${__CPM_LAST_MODULE_PREPROC}=${__CPM_FULL_UNID}" PARENT_SCOPE)
+    set(${DEFINITION_MAP_NAME} ${${DEFINITION_MAP_NAME}} "-D${__CPM_LAST_MODULE_PREPROC}=${__CPM_FULL_UNID}")
     set(__CPM_LAST_MODULE_PREPROC)

     # Ensure we log that we have added this source directory.


Add '-Og' for optimize when building "Debug"

GCC 6.3.1 did not like '-D_FORTIFY_SOURCE' without optimization. This
adds some small optimization suitable for debug.

Fixes #124. According to http://stackoverflow.com/questions/41009455/fortify-source-and-og-optimization-level
'-Og' should set optimization and thus silensing the warning.

--- cmake/Modules/DefineCompilerFlags.cmake
+++ cmake/Modules/DefineCompilerFlags.cmake
@@ -67,6 +67,11 @@

     if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
       add_definitions(-O)
+    else ()
+      check_c_compiler_flag("-Og" WITH_OPTIMIZE_FOR_DEBUG)
+      if (WITH_OPTIMIZE_FOR_DEBUG)
+        add_definitions(-Og)
+      endif ()
     endif ()
   endif (CMAKE_COMPILER_IS_GNUCC OR COMPILER_IS_CLANG)
 endif (UNIX)


[cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available

Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@291508 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -38,7 +38,18 @@
     set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
     set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
     set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
-    set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+
+    # --cmakedir is supported since llvm r291218 (4.0 release)
+    execute_process(
+      COMMAND ${LLVM_CONFIG_PATH} --cmakedir
+      RESULT_VARIABLE HAD_ERROR
+      OUTPUT_VARIABLE CONFIG_OUTPUT)
+    if(NOT HAD_ERROR)
+      string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
+    else()
+      set(LLVM_CMAKE_PATH
+          "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+    endif()
   else()
     set(LLVM_FOUND OFF)
     message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "


Fix condition in ogre-config

Fix condition in ogre-config

The previous form of if...else...else isn't supported anymore in recent CMake
versions

Change-Id: I7a3b56c70d2e23062934deaf818c247949d556a2
Reviewed-on: http://gerrit.aldebaran.lan/87324
Reviewed-by: ngargaud <cc1f618ae68946993764fd1e75c94e934d965a38@aldebaran-robotics.com>
Tested-by: ngargaud <cc1f618ae68946993764fd1e75c94e934d965a38@aldebaran-robotics.com>

--- cmake/qibuild/modules/ogre-config.cmake
+++ cmake/qibuild/modules/ogre-config.cmake
@@ -13,7 +13,7 @@
   string(REGEX MATCH "# *define +${VARIABLE} +((\"([^\n]*)\")|([^ \n]*))" _there "${ARGN}")
   if (CMAKE_MATCH_3)
     set(${VARIABLE} "${CMAKE_MATCH_3}" PARENT_SCOPE)
-  else(CMAKE_MATCH_4)
+  elseif(CMAKE_MATCH_4)
     set(${VARIABLE} "${CMAKE_MATCH_4}" PARENT_SCOPE)
   else()
     set(${VARIABLE} "0" PARENT_SCOPE)


Add NO_CONSOLE option.

Add NO_CONSOLE option.

	* build-aux/cmake/modules/Gostai.cmake: Here.

--- build-aux/cmake/modules/Gostai.cmake
+++ build-aux/cmake/modules/Gostai.cmake
@@ -23,7 +23,7 @@
   parse_arguments(
     ${name}
     "SOURCES;MOCS;UIS;CPPFLAGS;INCLUDE_DIRS;LIBRARIES;RESOURCES"
-    ""
+    "NO_CONSOLE"
     ${ARGN})

   # =================== #
@@ -97,11 +97,15 @@
   endif(WIN32)

   add_executable(${name} MACOSX_BUNDLE ${${name}_ALL_SOURCES})
-  if(CMAKE_BUILD_TYPE STREQUAL "Debug")
-    set_target_properties(${name} PROPERTIES WIN32_EXECUTABLE FALSE)
-  else(CMAKE_BUILD_TYPE STREQUAL "Debug")
+  if(${name}_NO_CONSOLE)
     set_target_properties(${name} PROPERTIES WIN32_EXECUTABLE TRUE)
-  endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
+  else(${name}_NO_CONSOLE)
+    if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+      set_target_properties(${name} PROPERTIES WIN32_EXECUTABLE FALSE)
+    else(CMAKE_BUILD_TYPE STREQUAL "Debug")
+      set_target_properties(${name} PROPERTIES WIN32_EXECUTABLE TRUE)
+    endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
+  endif(${name}_NO_CONSOLE)

   if(${name}_CPPFLAGS)
     set_target_properties(${name} PROPERTIES


update openblas version (#21450)

update openblas version (#21450)

test=develop

--- cmake/external/openblas.cmake
+++ cmake/external/openblas.cmake
@@ -22,7 +22,7 @@
         CACHE FILEPATH "openblas library." FORCE)
     SET(CBLAS_INC_DIR "${CBLAS_INSTALL_DIR}/include" CACHE PATH "openblas include directory." FORCE)
     SET(OPENBLAS_CC "${CMAKE_C_COMPILER} -Wno-unused-but-set-variable -Wno-unused-variable")
-    SET(OPENBLAS_COMMIT "v0.2.20")
+    SET(OPENBLAS_COMMIT "v0.3.7")

     IF(APPLE)
         SET(OPENBLAS_CC "${CMAKE_C_COMPILER} -isysroot ${CMAKE_OSX_SYSROOT}")
@@ -44,7 +44,6 @@
         BUILD_IN_SOURCE     1
         BUILD_COMMAND       make -j$(nproc) ${COMMON_ARGS} ${OPTIONAL_ARGS}
         INSTALL_COMMAND     make install NO_SHARED=1 NO_LAPACK=1 PREFIX=<INSTALL_DIR>
-                            && rm -r ${CBLAS_INSTALL_DIR}/lib/cmake ${CBLAS_INSTALL_DIR}/lib/pkgconfig
         UPDATE_COMMAND      ""
         CONFIGURE_COMMAND   ""
     )


FindGLIB2: Do not use REQUIRED to find PkgConfig and glib-2.0

--- cmake/modules/FindGLIB2.cmake
+++ cmake/modules/FindGLIB2.cmake
@@ -17,8 +17,10 @@
 endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)

 if (NOT WIN32)
-   find_package(PkgConfig REQUIRED)
-   pkg_check_modules(PKG_GLIB REQUIRED glib-2.0)
+  find_package(PkgConfig QUIET)
+  if(PKG_CONFIG_FOUND)
+    pkg_check_modules(PKG_GLIB QUIET glib-2.0)
+  endif()
 endif(NOT WIN32)

 find_path(GLIB2_MAIN_INCLUDE_DIR glib.h


cmake will now print the version of mysql it's using

--- cmake/modules/FindMySQL.cmake
+++ cmake/modules/FindMySQL.cmake
@@ -104,9 +104,9 @@
 			  "/usr/mysql/lib64/mysql" )
 endif()

-MESSAGE(STATUS "MySQL Library: ${MYSQL_LIBRARY}")
-MESSAGE(STATUS "MySQL Library Path: ${MYSQL_LIBRARY_PATH}")
-MESSAGE(STATUS "MySQL Include Path: ${MYSQL_INCLUDE_DIR}")
+#MESSAGE(STATUS "MySQL Library: ${MYSQL_LIBRARY}")
+#MESSAGE(STATUS "MySQL Library Path: ${MYSQL_LIBRARY_PATH}")
+#MESSAGE(STATUS "MySQL Include Path: ${MYSQL_INCLUDE_DIR}")

 if( MYSQL_INCLUDE_DIR AND EXISTS "${MYSQL_INCLUDE_DIR}/mysql_version.h" )
 	file( STRINGS "${MYSQL_INCLUDE_DIR}/mysql_version.h"
@@ -119,9 +119,10 @@
 # handle the QUIETLY and REQUIRED arguments and set MYSQL_FOUND to TRUE if
 # all listed variables are TRUE
 include( FindPackageHandleStandardArgs )
-find_package_handle_standard_args( MYSQL DEFAULT_MSG
-	MYSQL_LIBRARY MYSQL_LIBRARY_PATH MYSQL_INCLUDE_DIR
-	MYSQL_VERSION_STRING )
+find_package_handle_standard_args( MYSQL
+	REQUIRED_VARS MYSQL_LIBRARY MYSQL_LIBRARY_PATH MYSQL_INCLUDE_DIR
+	VERSION_VAR MYSQL_VERSION_STRING
+	)

 set( MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIR} )
 set( MYSQL_LIBRARIES ${MYSQL_LIBRARY} )


install all files matching libtbb.*

install all files matching libtbb.*

cmake 3.15 can install files with all symlinks but for 3.1 glob is
probably the easiest workaround

--- common/cmake/installTBB.cmake
+++ common/cmake/installTBB.cmake
@@ -14,7 +14,9 @@
       GET_TARGET_PROPERTY(IMPLIB_PATH TBB::tbb IMPORTED_IMPLIB_RELEASE)
       INSTALL(FILES ${IMPLIB_PATH} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
     ELSE()
-      INSTALL(FILES ${LIB_PATH} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
+      GET_FILENAME_COMPONENT(LIB_DIR ${LIB_PATH} DIRECTORY)
+      FILE(GLOB LIB_FILES ${LIB_DIR}/libtbb.*)
+      INSTALL(FILES ${LIB_FILES} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
     ENDIF()
   ELSE()
     MESSAGE(SEND_ERROR "Target TBB::tbb not found during install.")


cmake: Use options correctly

cmake: Use options correctly

--- cmake/modules/CompilerWarnings.cmake
+++ cmake/modules/CompilerWarnings.cmake
@@ -48,11 +48,11 @@

     endforeach(flag ${undesirable_flags})

-    if(${DISABLE_WERROR} STREQUAL ON)
+    if(DISABLE_WERROR)
         set(enable_werror 0)
-    else(${DISABLE_WERROR} STREQUAL ON)
+    else(DISABLE_WERROR)
         set(enable_werror 1)
-    endif(${DISABLE_WERROR} STREQUAL ON)
+    endif(DISABLE_WERROR)

     if(${werror_by_default} AND ${enable_werror} AND ${all_nowarning_flags_supported})
         set(${ret} "${warning_flags} ${error_flags}")


Add new freetype version.

Add new freetype version.

--HG--
branch : v1-9

--- CMake/Packages/FindFreetype.cmake
+++ CMake/Packages/FindFreetype.cmake
@@ -31,7 +31,7 @@
   FREETYPE_INCLUDE_DIR
 )

-set(FREETYPE_LIBRARY_NAMES freetype252 freetype251 freetype2501 freetype250 freetype2412 freetype2411 freetype2410 freetype249 freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype)
+set(FREETYPE_LIBRARY_NAMES freetype253 freetype252 freetype251 freetype2501 freetype250 freetype2412 freetype2411 freetype2410 freetype249 freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype)
 get_debug_names(FREETYPE_LIBRARY_NAMES)

 use_pkgconfig(FREETYPE_PKGC freetype2)


DOC: improve PreventInSourceBuilds error message

--- CMake/PreventInSourceBuilds.cmake
+++ CMake/PreventInSourceBuilds.cmake
@@ -30,7 +30,7 @@
     message("######################################################")
     message("# OTB should not be configured & built in the OTB source directory")
     message("# You must run cmake in a build directory outside of the source tree.")
-    message("# See the documentation for example build commands.")
+    message("# See the software guide documentation for example build commands.")
     message("# ")
     message("# NOTE: Given that you already tried to make an in-source build")
     message("#       CMake has already created several files & directories")


Set 4th Python path so that pygcw examples work in the build tree.

svn path=/trunk/; revision=10574

--- examples/python/plplot_python_start.py.cmake
+++ examples/python/plplot_python_start.py.cmake
@@ -8,3 +8,4 @@
 sys.path.insert (0, "@python_location1@")
 sys.path.insert (0, "@python_location2@")
 sys.path.insert (0, "@python_location3@")
+sys.path.insert (0, "@python_location4@")


Merging skipped test catch for MSVC

Merging skipped test catch for MSVC

--- cmake_modules/yolo/YOLOProjectAddTestCase.cmake
+++ cmake_modules/yolo/YOLOProjectAddTestCase.cmake
@@ -2,6 +2,7 @@

 # TODO: remove this: all tests shoulld be run, if some are omitted, a warning/error should at least be printed
 if (TUDAT_SKIP_JSON_TESTS)
+    # https://github.com/tudat-team/tudat/issues/8
     set(TEST_TO_BE_SKIPPED
             test_json_Acceleration
             test_json_Aerodynamics
@@ -22,6 +23,20 @@
 else ()
     set(TEST_TO_BE_SKIPPED
             )
+endif ()
+
+if (TUDAT_SKIP_BROKEN_MSVC_CLANG_PRECISION_TESTS)
+    # https://github.com/tudat-team/tudat/issues/7
+    set(TEST_TO_BE_SKIPPED ${TEST_TO_BE_SKIPPED}
+            test_basic_astro_OrbitalElementConversions
+            test_basic_astro_TimeConversions
+            test_basic_astro_SphericalOrbitStateConversions
+            test_shape_based_HodographicShaping
+            test_orbit_determination_EstimationInput
+            test_orbit_determination_HybridArcStateEstimation
+            test_propagators_VariationalEquations
+            test_basics_TimeTypes
+            test_io_MultiArrayReader)
 endif ()