forked from Kitware/CMake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VS: Fix nowarn compiler option to accept warning numbers.
Warning disables are transferred to the VS IDE `<NoWarn>` node. Fixes: #18878
- Loading branch information
Showing
12 changed files
with
132 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Tests/RunCMake/VS10Project/VsCSharpCompilerOpts-check.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# | ||
# Check C# VS project for required elements. | ||
# | ||
set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") | ||
if(NOT EXISTS "${csProjectFile}") | ||
set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") | ||
return() | ||
endif() | ||
|
||
|
||
set(inDebug FALSE) | ||
set(inRelease FALSE) | ||
set(debugOK FALSE) | ||
set(releaseOK FALSE) | ||
|
||
|
||
file(STRINGS "${csProjectFile}" lines) | ||
foreach(line IN LISTS lines) | ||
#message(STATUS ${line}) | ||
if(line MATCHES "^ *<PropertyGroup .*Debug\\|(Win32|x64).*") | ||
set(inDebug TRUE) | ||
elseif(line MATCHES "^ *<PropertyGroup .*Release\\|(Win32|x64).*") | ||
set(inRelease TRUE) | ||
elseif(line MATCHES "^ *</PropertyGroup> *$") | ||
set(inRelease FALSE) | ||
set(inDebug FALSE) | ||
elseif(inDebug AND | ||
(line MATCHES "^ *<NoWarn>.*505.*</NoWarn> *$") AND | ||
(line MATCHES "^ *<NoWarn>.*707.*</NoWarn> *$") AND | ||
(line MATCHES "^ *<NoWarn>.*808.*</NoWarn> *$") AND | ||
(line MATCHES "^ *<NoWarn>.*909.*</NoWarn> *$") | ||
) | ||
set(debugOK TRUE) | ||
elseif(inRelease AND | ||
(NOT (line MATCHES "^ *<NoWarn>.*505.*</NoWarn> *$")) AND | ||
(line MATCHES "^ *<NoWarn>.*707.*</NoWarn> *$") AND | ||
(line MATCHES "^ *<NoWarn>.*808.*</NoWarn> *$") AND | ||
(line MATCHES "^ *<NoWarn>.*909.*</NoWarn> *$") | ||
) | ||
set(releaseOK TRUE) | ||
endif() | ||
endforeach() | ||
|
||
function(print_csprojfile) | ||
file(STRINGS "${csProjectFile}" lines) | ||
foreach(line IN LISTS lines) | ||
message(STATUS ${line}) | ||
endforeach() | ||
endfunction() | ||
|
||
|
||
if(NOT debugOK) | ||
message(STATUS "Failed to set Debug configuration warning config correctly.") | ||
set(RunCMake_TEST_FAILED "Failed to set Debug configuration defines correctly.") | ||
print_csprojfile() | ||
return() | ||
endif() | ||
|
||
if(NOT releaseOK) | ||
message(STATUS "Failed to set Release configuration warning config correctly.") | ||
set(RunCMake_TEST_FAILED "Failed to set Release configuration defines correctly.") | ||
print_csprojfile() | ||
return() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
enable_language(CSharp) | ||
|
||
add_library(foo SHARED | ||
foo.cs) | ||
|
||
set_target_properties(foo PROPERTIES | ||
LINKER_LANGUAGE CSharp) | ||
|
||
|
||
# Issue 18878 | ||
target_compile_options(foo PRIVATE "/platform:anycpu" "/nowarn:707,808" "/nowarn:909" ) | ||
|
||
# Debug only warning disable | ||
set(CMAKE_CSharp_FLAGS_DEBUG "${CMAKE_CSharp_FLAGS_DEBUG} /nowarn:505") |