[cmake-developers] [CMake 0014022]: if(EXISTS) returns false for broken symlinks

Mantis Bug Tracker mantis at public.kitware.com
Mon Mar 18 10:40:20 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14022 
====================================================================== 
Reported By:                Petr Kmoch
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14022
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-03-18 15:40 CET
Last Modified:              2013-03-18 15:40 CET
====================================================================== 
Summary:                    if(EXISTS) returns false for broken symlinks
Description: 
'if(EXISTS arg)' evaluates to false if 'arg' is a symlink pointing to a
non-existent file. To me, this feels like incorrect behaviour - arg itself
exists, so the test should pass.

If the current behaviour is actually intended, I believe it should at least be
documented.

With Windows symlinks, this does not happen; 'if(EXISTS arg)' evaluates to true
if 'arg' is a broken link created with 'mklink'.

Steps to Reproduce: 
$ ln -s target link
$ cmake -P test_link.cmake <i>(attached)</i>
$ touch target
$ cmake -P test_link.cmake

'link' exists in both cases, but first run reports 'link does not exist'
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-03-18 15:40 Petr Kmoch     New Issue                                    
2013-03-18 15:40 Petr Kmoch     File Added: test_link.cmake                    
======================================================================




More information about the cmake-developers mailing list