diff options
author | Brad King <brad.king@kitware.com> | 2020-10-19 19:20:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-11 13:24:21 (GMT) |
commit | c257c25419c68e755b0f8289d8d563437bf9e0c2 (patch) | |
tree | 20418dcf8153ad50a55a4f7a4c0bc14cdb9de22f /Tests/RunCMake/VS10Project | |
parent | f36af9228b2ad36442f0cce9e8c8533fadef65aa (diff) | |
download | CMake-c257c25419c68e755b0f8289d8d563437bf9e0c2.zip CMake-c257c25419c68e755b0f8289d8d563437bf9e0c2.tar.gz CMake-c257c25419c68e755b0f8289d8d563437bf9e0c2.tar.bz2 |
add_custom_{command,target}: Add genex support to OUTPUT and BYPRODUCTS
Move rejection of `#`, `<`, and `>` characters in outputs and byproducts
to a generate-time check. This removes the front-end check that
disallowed generator expressions. The generators have already been
updated to handle them.
Fixes: #12877
Diffstat (limited to 'Tests/RunCMake/VS10Project')
-rw-r--r-- | Tests/RunCMake/VS10Project/CustomCommandGenex-check.cmake | 37 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/CustomCommandGenex.cmake | 21 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 |
3 files changed, 59 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/CustomCommandGenex-check.cmake b/Tests/RunCMake/VS10Project/CustomCommandGenex-check.cmake new file mode 100644 index 0000000..a7047bc --- /dev/null +++ b/Tests/RunCMake/VS10Project/CustomCommandGenex-check.cmake @@ -0,0 +1,37 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_CustomBuild_out 0) +set(found_CustomBuild_out_CONFIG 0) +set(found_CustomBuild_out_CONFIG_CONFIG 0) +set(found_CustomBuild_out_HASH 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES [[<CustomBuild Include=".*\\out\.txt\.rule">]]) + set(found_CustomBuild_out 1) + endif() + if(line MATCHES [[<CustomBuild Include=".*\\out-\(CONFIG\)\.txt\.rule">]]) + set(found_CustomBuild_out_CONFIG 1) + endif() + if(line MATCHES [[<CustomBuild Include=".*\\out-\(CONFIG\)-\(CONFIG\)\.txt\.rule">]]) + set(found_CustomBuild_out_CONFIG_CONFIG 1) + endif() + if(line MATCHES [[<CustomBuild Include=".*\\[0-9A-Fa-f]+\.rule">]]) + set(found_CustomBuild_out_HASH 1) + endif() +endforeach() +if(NOT found_CustomBuild_out) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for out.txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_CustomBuild_out_CONFIG) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for out-(CONFIG).txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_CustomBuild_out_CONFIG_CONFIG) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for out-(CONFIG)-(CONFIG).txt.rule not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_CustomBuild_out_HASH) + string(APPEND RunCMake_TEST_FAILED "CustomBuild for <hash>.rule not found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/CustomCommandGenex.cmake b/Tests/RunCMake/VS10Project/CustomCommandGenex.cmake new file mode 100644 index 0000000..5b69dc2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CustomCommandGenex.cmake @@ -0,0 +1,21 @@ +add_custom_command( + OUTPUT "$<1:out.txt>" + COMMAND ${CMAKE_COMMAND} -E touch "out.txt" + VERBATIM + ) +add_custom_command( + OUTPUT "out-$<CONFIG>.txt" + COMMAND ${CMAKE_COMMAND} -E touch "out-$<CONFIG>.txt" + VERBATIM + ) +add_custom_command( + OUTPUT "out-$<CONFIG>-$<CONFIG>.txt" + COMMAND ${CMAKE_COMMAND} -E touch "out-$<CONFIG>-$<CONFIG>.txt" + VERBATIM + ) +add_custom_command( + OUTPUT "out-$<CONFIG>-$<CONFIG:Debug>.txt" + COMMAND ${CMAKE_COMMAND} -E touch "out-$<CONFIG>-$<CONFIG:Debug>.txt" + VERBATIM + ) +add_custom_target(foo DEPENDS "out.txt" "out-$<CONFIG>.txt" "out-$<CONFIG>-$<CONFIG>.txt" "out-$<CONFIG>-$<CONFIG:Debug>.txt") diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 133dacc..d5ed136 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -7,6 +7,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREA run_cmake(LanguageStandard) endif() +run_cmake(CustomCommandGenex) run_cmake(VsCsharpSourceGroup) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) |