How to supress nuget warnings warnings in msbuild/visual studio - msbuild

I have the following warning from VS2017
15>C:\Users\phelan\workspace\weincad.net\WeinCad.Plugin\WeinCad.Plugin.csproj
: warning NU1602: FSharpx.Async 1.13.2 does not provide an inclusive
lower bound for dependency FSharp.Control.AsyncSeq. An approximate
best match of FSharp.Control.AsyncSeq 1.13.0 was resolved.
That is warning NU1602
I have added
<PropertyGroup >
<NoWarn>NU1602</NoWarn>
</PropertyGroup>
to my Directory.Build.props file.
Nuget documentation claims that the nuget warnings will be respected by the NoWarn directives.
The errors and warnings listed here are available only with
PackageReference-based projects and NuGet 4.3.0. NuGet also honors
MSBuild properties to suppress warnings or elevate them to errors. For
more information, see How to: Suppress Compiler Warnings in the Visual
Studio documentation.
but the suppression is not respected. Is this a bug or am I doing something wrong.

Most probably you are hitting a bug tracked by issue #5740 NoWarn on a package reference does not apply transitively to its dependencies in NuGet repo.
The warning is raised not due to direct project dependency FSharpx.Async 1.13.2 but by that package dependency FSharp.Control.AsyncSeq

Related

Dependencies between Android native modules (prefab) fail to build

Our Android application consists of 40-some Android Library Modules (ALMs), each of which also builds a C++ shared library with externalNativeBuild and CMake. So far we had the dependencies between these libs set up like this:
The dependent ALM references the dependency ALM with api project(':lib')
The dependent CMake script references the dependency .so with add_library(SHARED IMPORTED lib) and set_target_properties(lib PROPERTIES IMPORTED_LOCATION ...) and a relative path.
Recently we had to upgrade to the latest Android API version. This started off a cascade because now we were getting deprecated warnings in code generated by the navigation-ktx library, but upgrading that requires upgrading Gradle and the Android Gradle plugin. After that I started getting errors like liblib.so, needed by 'project', missing and no known rule to make it.
It looks like the latest Gradle parallelizes build tasks more heavily, and this means the dependent CMake/Ninja builds are being started concurrently with their dependencies, resulting in this error because the dependency is not yet built. I figured out that what we were doing was not entirely supported, but there is a "supported" way to do that now, so I refactored our entire build to use Prefab.
Now I started getting other errors, alternating between:
1.
C++ build system [prefab] failed while executing ...
Usage: prefab [OPTIONS] PACKAGE_PATH...
Error: Invalid value for "PACKAGE_PATH": Directory ... is not readable.
ld: error: undefined symbol ...
I looked into build/intermediates and found that in the 2nd case, the cmake config script was generated incorrectly: instead of add_library(lib::lib SHARED IMPORTED ) it had add_library(lib::lib INTERFACE IMPORTED) like it it was a header only library, and there was no IMPORTED_LOCATION set in the file.
What am I doing wrong and what should I do to unbreak our build?
It looks like the toolchain support for prefab interdependencies within a project is not quite finished. Others are reporting the same kind of errors at https://issuetracker.google.com/issues/265544858:
This appears to be a race condition with generating prefab cmake files.
It says in https://issuetracker.google.com/issues/221231432 that the header-only cmake config is generated to satisfy Android Studio's IDE features (completion, etc.) before the library is actually built.
Treat as-yet-unconfigured modules as if they are Header-only libraries for Android Studio purposes. This works because Android Studio doesn't care about linker flags for the purposes of providing language services.

CMake equivalent of APP_ALLOW_MISSING_DEPS

I am moving an Android project from ndk to CMake.
In Application.mk we set following flag:
APP_ALLOW_MISSING_DEPS := true
But I couldn't find equivalent cmake flag for this. Can this be set from cmake arguments?
If you need this flag in ndk-build it means your Android.mk is wrong. That flag tells ndk-build to ignore garbage in your build script. It makes unknown dependencies exactly as meaningful as whitespace. The same behavior is achieved by removing the uses of the unknown deps from your Android.mk. ndk-build tells you this in the warning:
Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build.
Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies.

GTest/GMock produces linker error with vcpkg

In the cmake file for my project, I include googletest as a dependency using git submodules. This works fine. When I then also add dependencies through vcpkg (for example Boost), I get the following linker error:
LNK2001 unresolved external symbol
"class testing::internal::Mutex testing::internal::g_linked_ptr_mutex" (?g_linked_ptr_mutex#internal#testing##3VMutex#12#A)
This is caused by a conflicting version of GoogleTest in your vcpkg installation. Certain libraries will cause the entire vcpkg include directory to be included in your project. If you have previously installed gtest/gmock in vcpkg, this version can be accidentally brought into scope by including a different package.
The easiest way to resolve this is to remove the vcpkg version of gtest:
vcpkg remove gtest gmock
You might have to repeat this command for different platform targets.
Alternatively, you can also remove the submodule and use the vcpkg version of gtest.

How to with CPack generate the WIX package?

I used cmake 3.12.0. There are exists one cmake project that creates one console application. I add the ability of package generation to that cmake project:
# ... above cmake code for one console application creation
# below code that I add:
# pack
set (A_PACK_DESCRIPTION_SUMMARY "${PROJECT_NAME} - CMake Assistant Solution")
set (A_INSTALL_PREFIX Consolas)
set(CPACK_WIX_PRODUCT_GUID "F9AAAAE2-D6AF-4EA4-BF46-B3E265400CC8")
set(CPACK_WIX_UPGRADE_GUID "F9AAAAE2-D6AF-4EA4-BF46-B3E265400CC7")
set(CPACK_GENERATOR "WIX")
include(CPack)
With other generators (NSIS, 7Z, ZIP, DEB) all works fine but with WIX appears followed error:
...path\files.wxs(11) : error LGHT0091 : Duplicate symbol 'Component:CM_C_EMPTY_INSTALL_ROOT' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.
Why it happens and how to fix it?
This appears to be caused by this bug
Basically you use add_subdirectory(xxx EXCLUDE_FROM_ALL) where the subdirectory has a install(... COMPONENT ...) call. The installed files are excluded from the subdirectory, but still creates COMPONENTs, which are now empty and break wix.
As a workaround, you can add:
set(CPACK_COMPONENTS_ALL Unspecified)
in CMakeLists.txt to exclude all the empty components.
If it helps any, I had this problem and found that I had INSTALL commands that specified only Release Configurations but then tried to build the package using the Debug build configuration. By just switching to building the package specifying the Release configuration all went as expected (Wasted most of an afternoon before I figured this out!)

Windows 10, VS 2013: Cmake error while configuring OpenCL program

I'm trying to build this Github project in Windows. Getting the error below. I've installed the AMD SDK and added the path to PATH variable. Please let me know how to overcome this issue.
CMake Error at CMakeLists.txt:94 (find_package):
By not providing "FindOpenCL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCL", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCL" with any
of the following names:
OpenCLConfig.cmake
opencl-config.cmake
Add the installation prefix of "OpenCL" to CMAKE_PREFIX_PATH or set
"OpenCL_DIR" to a directory containing one of the above files. If "OpenCL"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
According to docs, CMake provides FindOpenCL.cmake module since version 3.1. So you need at least CMake 3.1 for build given project.
Actually, it is the project's cmake_minimum_required who should provide correct constraint.