diff options
author | Brad King <brad.king@kitware.com> | 2019-11-05 16:30:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-11-05 16:30:27 (GMT) |
commit | cb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5 (patch) | |
tree | fff2895e42c8b994a8b8fafccc72e57d5f19a3d9 /Tests/RunCMake/VS10Project | |
parent | a269c77edb7c9d55efa1fbac46ed84173a7dcbc9 (diff) | |
parent | 3c0ca5a9d9d538da41e99207da22f55496bdf553 (diff) | |
download | CMake-cb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5.zip CMake-cb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5.tar.gz CMake-cb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5.tar.bz2 |
Merge topic 'source_group-tree'
3c0ca5a9d9 source_group: ensure that passed file is not a directory
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3979
Diffstat (limited to 'Tests/RunCMake/VS10Project')
-rw-r--r-- | Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake | 33 |
2 files changed, 32 insertions, 2 deletions
diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake index 655120a..ee0c412 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake @@ -13,6 +13,7 @@ include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake) set(SOURCE_GROUPS_TO_FIND "Dir" "Dir\\DirNested" + "Generated" "SourcesPrefix" "SourcesPrefix\\PrefixedNested" ) diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake index 83c87a9..7655e60 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake @@ -1,16 +1,45 @@ set(CMAKE_CONFIGURATION_TYPES Debug) +# Test regular tree grouping. set(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Dir/foo.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Dir/DirNested/foo_nested.cpp ) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SRC_FILES}) + + +# Test files that are not present at configuration time. +set(GENERATED_SRC_FILES + ${CMAKE_CURRENT_BINARY_DIR}/Generated/generated.cpp +) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Generated) + +if(WIN32) + add_custom_command(OUTPUT ${GENERATED_SRC_FILES} + COMMAND echo. 2>${CMAKE_CURRENT_BINARY_DIR}\\Generated\\generated.cpp + ) +else() + add_custom_command(OUTPUT ${GENERATED_SRC_FILES} + COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/Generated/generated.cpp + ) +endif() + +source_group(TREE ${CMAKE_CURRENT_BINARY_DIR} FILES ${GENERATED_SRC_FILES}) + + +# Test prefixed tree grouping. set(PREFIXED_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed/bar.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed/PrefixedNested/bar_nested.cpp ) -add_custom_target(SourceGroupTree SOURCES ${SRC_FILES} ${PREFIXED_SRC_FILES}) +add_custom_target(SourceGroupTree + SOURCES + ${SRC_FILES} + ${GENERATED_SRC_FILES} + ${PREFIXED_SRC_FILES} +) -source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SRC_FILES}) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed PREFIX SourcesPrefix FILES ${PREFIXED_SRC_FILES}) |