]> granicus.if.org Git - icu/commitdiff
ICU-20076 MSVC Warning clean up. Define _HAS_EXCEPTIONS=0 in ICU library code (#128)
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Wed, 19 Sep 2018 08:21:57 +0000 (01:21 -0700)
committerShane Carr <shane@unicode.org>
Thu, 27 Sep 2018 21:27:41 +0000 (14:27 -0700)
In an effort to reduce the number of warnings that building ICU emits, we should set the following define for ICU4C library code when building using MSVC/VisualStudio: _HAS_EXCEPTIONS=0
This tells the MSVC implementation of the STL that exceptions should not be used - which is fine for ICU4C library code, as the library code does not make use of exceptions at all.

icu4c/source/allinone/Build.Windows.Library.ProjectConfiguration.props [new file with mode: 0644]
icu4c/source/common/common.vcxproj
icu4c/source/common/common_uwp.vcxproj
icu4c/source/i18n/i18n.vcxproj
icu4c/source/i18n/i18n_uwp.vcxproj
icu4c/source/io/io.vcxproj
icu4c/source/stubdata/stubdata.vcxproj

diff --git a/icu4c/source/allinone/Build.Windows.Library.ProjectConfiguration.props b/icu4c/source/allinone/Build.Windows.Library.ProjectConfiguration.props
new file mode 100644 (file)
index 0000000..07e3c1b
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html -->
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <!-- This file is used to set configurations that are common to *all* ICU library code (common, i18n, and io). -->
+  <!-- Note: These options are for *all* configurations for *all* library projects.  -->
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <!-- ICU does not use exceptions in library code. -->
+      <PreprocessorDefinitions>
+        _HAS_EXCEPTIONS=0;
+        %(PreprocessorDefinitions)
+      </PreprocessorDefinitions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <PropertyGroup>
+    <!-- Disable MSBuild warning about Linker OutputFile. -->
+    <!-- Ex: MSBuild complains that the common project creates "icuuc62.dll" rather than "common.dll". However, this is intentional. -->
+    <MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>
+  </PropertyGroup>
+</Project>
index 2495a89563928bff60a9c397efbc04b2e1b65303..6c5ed380bf360167ccdeb087efa313ad8171490e 100644 (file)
@@ -2,6 +2,8 @@
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <!-- The following import will include the 'default' configuration options for VS projects. -->
   <Import Project="..\allinone\Build.Windows.ProjectConfiguration.props" />
+  <!-- The following import will include the library configuration options for VS projects. -->
+  <Import Project="..\allinone\Build.Windows.Library.ProjectConfiguration.props" />
   <PropertyGroup Label="Globals">
     <ProjectGuid>{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}</ProjectGuid>
   </PropertyGroup>
index a3801840669460741fd7e04ede8fc7ac8935a2d9..447e7b323c9e173f53c614f7c67a233e0a74bcb0 100644 (file)
@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <!-- The following import will include the UWP configuration options for VS projects. -->
   <Import Project="..\allinone\Build.Windows.UWP.ProjectConfiguration.props" />
+  <!-- The following import will include the library configuration options for VS projects. -->
+  <Import Project="..\allinone\Build.Windows.Library.ProjectConfiguration.props" />
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
index fe1e71d905cae948bda8739f647f4b50689b2c4b..65a862bda8366e9b9497bf42650cbe51eeb04ae4 100644 (file)
@@ -2,6 +2,8 @@
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <!-- The following import will include the 'default' configuration options for VS projects. -->
   <Import Project="..\allinone\Build.Windows.ProjectConfiguration.props" />
+  <!-- The following import will include the library configuration options for VS projects. -->
+  <Import Project="..\allinone\Build.Windows.Library.ProjectConfiguration.props" />
   <PropertyGroup Label="Globals">
     <ProjectGuid>{0178B127-6269-407D-B112-93877BB62776}</ProjectGuid>
   </PropertyGroup>
index bdc42e64a66b6480699b7a6e95637c36569536c4..a072e7cf9d81bc0a84a653537aa40fc375e938c8 100644 (file)
@@ -2,6 +2,8 @@
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <!-- The following import will include the 'default' configuration options for VS UWP projects. -->
   <Import Project="..\allinone\Build.Windows.UWP.ProjectConfiguration.props" />
+  <!-- The following import will include the library configuration options for VS projects. -->
+  <Import Project="..\allinone\Build.Windows.Library.ProjectConfiguration.props" />
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
index 2144dbe710836969189d4055f9be0946550d2413..fae6d1d4228f3d705bdfb94cc2100dadd17a1692 100644 (file)
@@ -2,7 +2,8 @@
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <!-- The following import will include the 'default' configuration options for VS projects. -->
   <Import Project="..\allinone\Build.Windows.ProjectConfiguration.props" />
-
+  <!-- The following import will include the library configuration options for VS projects. -->
+  <Import Project="..\allinone\Build.Windows.Library.ProjectConfiguration.props" />
   <PropertyGroup Label="Globals">
     <ProjectGuid>{C2B04507-2521-4801-BF0D-5FD79D6D518C}</ProjectGuid>
   </PropertyGroup>
index aff344d9a0b774bda026bd4db61faea65d2c1f93..d289d000b1fe035235c10bb08812f5e5420b31d8 100644 (file)
@@ -2,7 +2,8 @@
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <!-- The following import will include the 'default' configuration options for VS projects. -->
   <Import Project="..\allinone\Build.Windows.ProjectConfiguration.props" />
-
+  <!-- The following import will include the library configuration options for VS projects. -->
+  <Import Project="..\allinone\Build.Windows.Library.ProjectConfiguration.props" />
   <PropertyGroup Label="Globals">
     <ProjectGuid>{203EC78A-0531-43F0-A636-285439BDE025}</ProjectGuid>
   </PropertyGroup>