diff options
author | Johnny Jazeix <jazeix@gmail.com> | 2019-12-26 16:39:36 (GMT) |
---|---|---|
committer | Johnny Jazeix <jazeix@gmail.com> | 2019-12-26 16:39:36 (GMT) |
commit | a024d614ca60080e71cdca6c56fed44f9a9e64a3 (patch) | |
tree | d3b59c97824e5f6c632b1501407ba1f79968909a /Tests/RunCMake/try_compile | |
parent | 419fd17aa99576cf75ea083eef2e93b80688c37b (diff) | |
download | CMake-a024d614ca60080e71cdca6c56fed44f9a9e64a3.zip CMake-a024d614ca60080e71cdca6c56fed44f9a9e64a3.tar.gz CMake-a024d614ca60080e71cdca6c56fed44f9a9e64a3.tar.bz2 |
cmCoreTryCompile::CleanupFiles now removes symlinks instead of their contents.
Fixes: #17522
Diffstat (limited to 'Tests/RunCMake/try_compile')
-rw-r--r-- | Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake | 21 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/RunCMakeTest.cmake | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake b/Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake new file mode 100644 index 0000000..dea0f61 --- /dev/null +++ b/Tests/RunCMake/try_compile/CleanupNoFollowSymlink.cmake @@ -0,0 +1,21 @@ +enable_language(C) + +set(out "${CMAKE_CURRENT_BINARY_DIR}/folder") +set(link_folder "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp") +set(link_dir "${link_folder}/link_dir") +file(MAKE_DIRECTORY "${out}") +file(MAKE_DIRECTORY "${link_folder}") +file(WRITE ${out}/empty_file "") +file(CREATE_LINK ${out} ${link_dir} SYMBOLIC) + +try_compile(res ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c) + +if(EXISTS ${link_dir}) + message(FATAL_ERROR "did not remove ${link_dir}") +endif() +if(NOT EXISTS ${out}) + message(FATAL_ERROR "should not have removed ${out}/dir") +endif() + +file(REMOVE_RECURSE "${out}") diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index e838b2d..bee9e5b 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -94,3 +94,7 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) endif() + +if(UNIX) + run_cmake(CleanupNoFollowSymlink) +endif() |