Fix VS build when assembler is enabled
The whitespace in the _STL_EXTRA_DISABLED_WARNINGS value was creating issues
for the CMake generated assembler build script called by VS.
By narrowing the build scope of this STL (and thus C++ only) variable to only C++
we avoid the problem altogether as it will not be passed to the assembler script.
Change-Id: Id422bdd991492f39acc82d52af2ea6d952deb6c6
Reviewed-on: https://boringssl-review.googlesource.com/29504
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad5b77e..3ec6ac9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,8 +172,12 @@
add_definitions(-DNOMINMAX)
# Allow use of fopen.
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
- # VS 2017 and higher supports STL-only warning suppressions.
- add_definitions("-D_STL_EXTRA_DISABLED_WARNINGS=4774 4987")
+ # VS 2017 and higher supports STL-only warning suppressions. Manually add to
+ # C++ only to work around a CMake quoting bug when using NASM with the Visual
+ # Studio generator.
+ #
+ # TODO(davidben): Send a patch to CMake and link to it here.
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D_STL_EXTRA_DISABLED_WARNINGS=4774\ 4987>)
endif()
if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.7.99") OR