View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011973CMake(No Category)public2011-03-15 15:322011-06-17 18:40
ReporterAaron Simmons 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMacOSOS XOS Version10.6
Product VersionCMake 2.8.4 
Target VersionCMake 2.8.5Fixed in VersionCMake 2.8.5 
Summary0011973: double-slashes in paths breaks dependency resolution
DescriptionConcatenating paths often leads to double-slashes. Most software seems to be able to deal with this, including CMake (2.8.3 and previous). However, CMake 2.8.4 can't handle it.

Steps To Reproduce1) Here is an example CMakeLists.txt:
            cmake_minimum_required(VERSION 2.8.4)
            project(test)

            set(dir_to ${CMAKE_BINARY_DIR}/files/) # note the trailing sash

            set(myfile_from ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt)
            set(myfile_to ${dir_to}/myfile.txt)
            get_filename_component( parent_to ${myfile_to} PATH )

            message("${myfile_from} => ${myfile_to}")

            ADD_CUSTOM_COMMAND(
              OUTPUT ${myfile_to}
              COMMAND ${CMAKE_COMMAND} -E make_directory ${dir_to}
              COMMAND ${CMAKE_COMMAND} -E copy ${myfile_from} ${myfile_to}
              DEPENDS ${myfile_from}
             )
            add_custom_target(copyit DEPENDS ${myfile_to})

2) Run it:
asimmons-mac:.build asimmons$ rm -rf *; cmake ..; make copyit
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
/Users/asimmons/Development/test/cmake/myfile.txt => /Users/asimmons/Development/test/cmake/.build/files//myfile.txt
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/asimmons/Development/test/cmake/.build
Scanning dependencies of target copyit
make[3]: *** No rule to make target `files/myfile.txt', needed by `CMakeFiles/copyit'. Stop.
make[2]: *** [CMakeFiles/copyit.dir/all] Error 2
make[1]: *** [CMakeFiles/copyit.dir/rule] Error 2
make: *** [copyit] Error 2

3) Removing the trailing slash from line 4 will workaround the problem.

Additional InformationNotice that the error output (*** No rule to make target `files/myfile.txt') has removed the double-slash. It seems like part of CMake can deal with the double-slash, but others can't.

Since previous CMake verions (2.8.3-) could deal with double-slashes, I assume that this is a bug. If its deliberate, I urge you to consider the pain involved in constantly checking path concatenations for double slashes. At least provide some kind of "path concat" function.
TagsNo tags attached.
Attached Files

 Relationships
related to 0010485closedBrad King add_custom_command searches literally for file name targets 

  Notes
(0025958)
Brad King (manager)
2011-03-29 18:11

This regression appeared in this commit:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a75a0a14 [^]

meant to fix similar issue 0010485.
(0025959)
Brad King (manager)
2011-03-29 18:20

As linked in 0011973:0025958 the OUTPUTS of add_custom_command are now slash-normalized to match the behavior of add_executable and add_library. The same must now be done for the DEPENDS of add_custom_(target|command).
(0025968)
Brad King (manager)
2011-03-30 10:05

Fixed and test added:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12860505 [^]

 Issue History
Date Modified Username Field Change
2011-03-15 15:32 Aaron Simmons New Issue
2011-03-29 18:09 Brad King Relationship added related to 0010485
2011-03-29 18:09 Brad King Assigned To => Brad King
2011-03-29 18:09 Brad King Status new => assigned
2011-03-29 18:11 Brad King Note Added: 0025958
2011-03-29 18:20 Brad King Note Added: 0025959
2011-03-30 10:05 Brad King Note Added: 0025968
2011-03-30 10:05 Brad King Status assigned => closed
2011-03-30 10:05 Brad King Resolution open => fixed
2011-06-17 18:40 David Cole Fixed in Version => CMake 2.8.5
2011-06-17 18:40 David Cole Target Version => CMake 2.8.5


Copyright © 2000 - 2018 MantisBT Team