summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2015-03-17 22:34:03 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-20 13:45:25 (GMT)
commita2c068a7ce47ab5934735b9f9168dda9760646ec (patch)
treeb6619fd89eebce8675685db87ab7deadc28b39de /Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
parenta5cab2e7391df8d2072f1083c075a69bc746c7aa (diff)
downloadCMake-a2c068a7ce47ab5934735b9f9168dda9760646ec.zip
CMake-a2c068a7ce47ab5934735b9f9168dda9760646ec.tar.gz
CMake-a2c068a7ce47ab5934735b9f9168dda9760646ec.tar.bz2
file: Teach GLOB to list directories optionally
GLOB lists directories by default and GLOB_RECURSE does not. LIST_DIRECTORIES enables user to control the behavior explicitly for consistently for both GLOB and GLOB_RECURSE.
Diffstat (limited to 'Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake')
-rw-r--r--Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
new file mode 100644
index 0000000..a8c6784
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
@@ -0,0 +1,23 @@
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3")
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/recursion")
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "message to write")
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/file_symlink")
+
+file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
+list(LENGTH CONTENT_LIST CONTENT_COUNT)
+message("content: ${CONTENT_COUNT} ")
+list(SORT CONTENT_LIST)
+message("${CONTENT_LIST}")
+
+file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
+list(LENGTH CONTENT_LIST CONTENT_COUNT)
+message("content: ${CONTENT_COUNT} ")
+list(SORT CONTENT_LIST)
+message("${CONTENT_LIST}")
+
+file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
+list(LENGTH CONTENT_LIST CONTENT_COUNT)
+message("content: ${CONTENT_COUNT} ")
+list(SORT CONTENT_LIST)
+message("${CONTENT_LIST}")