diff options
author | Brad King <brad.king@kitware.com> | 2018-10-30 13:37:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-31 13:13:19 (GMT) |
commit | a56edad6d61268204af8228b8d58fa26d8f72269 (patch) | |
tree | 0d3fb5b71f8f83db49b7eed811defe2902f48c44 /Tests/RunCMake/CSharpCustomCommand/RunCMakeTest.cmake | |
parent | f87d5f13c29a961238ccf623d4954d2d0636adaa (diff) | |
download | CMake-a56edad6d61268204af8228b8d58fa26d8f72269.zip CMake-a56edad6d61268204af8228b8d58fa26d8f72269.tar.gz CMake-a56edad6d61268204af8228b8d58fa26d8f72269.tar.bz2 |
CSharp: Fix regression in VS project type selection for custom target
A target created by `add_custom_target` should always be a `.vcxproj`
file even if it has `.cs` sources involved in custom commands and such.
The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7
(remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget,
2018-03-19). The reason is that the `HasLanguage` method added by
commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as
wrapper for GetLanguages(), 2018-03-19) does not check the target type
and so is not a suitable check for deciding the project file extension.
The `HasLanguage` method was an attempt at an abstraction that turns
out not to work very well. Replace it with a dedicated `IsCSharpOnly`
method that considers the target type, sources, and non-transitive
`LINKER_LANGUAGE`.
Fixes: #18515
Diffstat (limited to 'Tests/RunCMake/CSharpCustomCommand/RunCMakeTest.cmake')
-rw-r--r-- | Tests/RunCMake/CSharpCustomCommand/RunCMakeTest.cmake | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Tests/RunCMake/CSharpCustomCommand/RunCMakeTest.cmake b/Tests/RunCMake/CSharpCustomCommand/RunCMakeTest.cmake index fa5618a..ab3e51b 100644 --- a/Tests/RunCMake/CSharpCustomCommand/RunCMakeTest.cmake +++ b/Tests/RunCMake/CSharpCustomCommand/RunCMakeTest.cmake @@ -1,5 +1,13 @@ include(RunCMake) +function(run_TargetWithCommand) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TargetWithCommand-build) + run_cmake(TargetWithCommand) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(TargetWithCommand-build ${CMAKE_COMMAND} --build . --config Debug) +endfunction() +run_TargetWithCommand() + # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommandWithOutput-build) set(RunCMake_TEST_NO_CLEAN 1) |