Suppress a CMake Warning (#21147)
authorSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>
Wed, 5 Dec 2018 20:55:39 +0000 (12:55 -0800)
committerJeremy Koritzinsky <jkoritzinsky@gmail.com>
Wed, 5 Dec 2018 20:55:39 +0000 (12:55 -0800)
* Suppress a CMake Warning

This change adds a local cmake_policy rule to suppress
warnings about libraries with unicode names.

```
CMake Warning (dev) at tests/src/Interop/PInvoke/DllImportPath/CMakeLists.txt:14 (add_library):
  Policy CMP0037 is not set: Target names should not be reserved and should
  match a validity pattern.  Run "cmake --help-policy CMP0037" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  The target name "DllImportPath_U�n�i�c�o�d�e" is reserved or
  not valid for certain CMake features, such as generator expressions, and
  may result in undefined behavior.
This warning is for project developers.  Use -Wno-dev to suppress it.
```

* Update tests/src/Interop/PInvoke/DllImportPath/CMakeLists.txt

Co-Authored-By: swaroop-sridhar <Swaroop.Sridhar@microsoft.com>
tests/src/Interop/PInvoke/DllImportPath/CMakeLists.txt

index a0d2992..34634b5 100644 (file)
@@ -5,6 +5,13 @@ include_directories(${INC_PLATFORM_DIR})
 set(SOURCES 
     DllImportPathNative.cpp 
 ) 
+
+# Set CMP0037 to OLD for this directory, so that
+# CMake doesn't complain about the libraries with Unicode characters.
+if(NOT (CMAKE_MAJOR_VERSION LESS 3)) 
+    cmake_policy(SET CMP0037 OLD)
+endif()
+  
 # Additional files to reference: 
 # add the executable 
 add_library (DllImportPath_Local SHARED ${SOURCES})