[cmake-developers] [CMake 0014023]: cmake -E touch / touch_nocreate of a directory fails on Windows yet succeeds on Linux

Mantis Bug Tracker mantis at public.kitware.com
Mon Mar 18 13:15:23 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14023 
====================================================================== 
Reported By:                Andreas Mohr
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14023
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-03-18 13:15 EDT
Last Modified:              2013-03-18 13:15 EDT
====================================================================== 
Summary:                    cmake -E touch / touch_nocreate of a directory fails
on Windows yet succeeds on Linux
Description: 
Touching a *file* returns success on both Windows and Linux, yet touching a
*directory* succeeds on Linux (ext3) and fails on Windows 7 32bit (NTFS).
Of course I wouldn't be reporting it here if it weren't for the fact that I got
a bloody nose from that ;)
(while trying to use these things in a build-time mechanism)

I'm not quite sure whether this really is something that should be made
consistent in CMake's implementation, since it might simply be a difference in
underlying filesystem mechanisms of the platforms.

IOW, I don't know whether CMake's system-side implementation contains a stupid
mistake,
or whether it's simply that touch:ing a directory on Windows is supposed to do
what it currently does.

Any ideas, hints?

Thanks!

Steps to Reproduce: 
cmake_minimum_required(VERSION 2.6)

project(test_touch_nocreate NONE)

set(touch_sample_1 "${CMAKE_BINARY_DIR}/mytestdir")
file(MAKE_DIRECTORY "${touch_sample_1}")

set(touch_sample_2 "${CMAKE_CURRENT_LIST_FILE}")

set(mytouch "${touch_sample_1}")
# This works:
#set(mytouch "${touch_sample_2}")

# Does not matter whether we choose touch or touch_nocreate.
set(touch_cmd_1 "touch")
set(touch_cmd_2 "touch_nocreate")

set(touch_cmd "${touch_cmd_1}")

execute_process(
  COMMAND "${CMAKE_COMMAND}" -E ${touch_cmd} "${mytouch}"
  RESULT_VARIABLE res
)
message("res is ${res}")

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-03-18 13:15 Andreas Mohr   New Issue                                    
======================================================================




More information about the cmake-developers mailing list