View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010994CMakeCMakepublic2010-07-15 04:582013-10-07 10:09
ReporterPatrick Spendrin 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformWindowsOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010994: Windows: find_* commands can find paths with no drive letter
Descriptionwhen using substituted drives on windows, cmake should treat them like real drives. this doesn't happen in the attached testcase.

Our setup:
- substitute any directory with the cmd command subst.
- have a cmake file within that directory, but not within the root directory of that drive. This cmake file tries to find out its location using CMAKE_CURRENT_LIST_FILE and get_filename_component(PATH) to get the parent directory of a directory. When reaching the root directory, just a (back)slash is given instead of the complete drive letter + colon.

To reproduce, please try out the attached zip archive and simply run the runtest.bat batch file. The cmake file in question is in the test subdirectory.

Additional InformationThis happens on all windows systems.
TagsNo tags attached.
Attached Fileszip file icon cmake_current_list_file-bug.zip [^] (1,240 bytes) 2010-07-15 04:58
zip file icon cmake-bug.zip [^] (1,243 bytes) 2010-07-15 08:30
diff file icon cmake-stat-drives.diff [^] (531 bytes) 2010-07-15 12:20 [Show Content]
diff file icon cmake-root-relative.diff [^] (601 bytes) 2010-07-15 15:37 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to 0011153closed cmake out of source build writes build files at source dirs 
related to 0010072closedBrad King invalid binary path if makefile in root directory 

-  Notes
(0021396)
Patrick Spendrin (reporter)
2010-07-15 08:33

ok, skip the first description, here comes the real issue:
when including the file with include() there will not be any problems, when the file is included via find_package() (also see cmake-bug.zip) then the result will be a single slash instead of the correct Z:/.

To reproduce, please unpack cmake-bug.zip and call runtest.bat in that directory (I hope you don't have Z: as a drive already given, in that case simply change the drive letter.)
(0021403)
Patrick Spendrin (reporter)
2010-07-15 15:43

ok, the two patches do the following:
The cmake-stat-drives.diff enables stat on simple drive letters (e.g. C:, Z:, etc.) - this will fail otherwise and thus adding Z: to CMAKE_SYSTEM_PREFIX_PATH in share/cmake-2.8/Modules/Platform/WindowsPaths.cmake will not result in the expected result.
The cmake-root-relative.diff will handle the case where / is given as the only path - in that case, the relative path base will be chosen. This part is restricted to non-cygwin windows, which should not result in any conflicts.
(0032936)
Chris (reporter)
2013-04-24 20:26
edited on: 2013-04-24 21:32

This problem is still occurring.

Is there anything I can do to help find a fix. It is making it impossible for me to compile kde on windows

EDIT:

The test case supplied does not fail for me. I guess my problem is similar but not identical.

I will update if any other information is found.

(0032939)
Chris (reporter)
2013-04-24 23:36

Update

While the simple test case does not fail for me. it does show the error occurring

the following is generated when running the script

Z:\build>cmake ..\
-- Building for: Visual Studio 10
-- final import prefix is :- <<Z:/>>
-- final import prefix is :- <</>>
-- Configuring done
-- Generating done
-- Build files have been written to: Z:/build

you can see the drive mysteriously changes from <<Z:/>> to <</>>

the first import prefix is inside include(${CMAKE_CURRENT_SOURCE_DIR}/lib/strigitest/StrigitestConfig.cmake)
the second import prefix is inside find_package(Strigitest REQUIRED)

find_package appears to drop the drive when converting from \ to /

This is also being discussed at
http://permalink.gmane.org/gmane.comp.programming.tools.cmake.devel/6711 [^]
(0032940)
Brad King (manager)
2013-04-25 09:22

This commit should fix it:

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

See commit message for explanation.
(0032941)
Brad King (manager)
2013-04-25 09:27

For reference, here is the context of the discussion linked in 0010994:0032939:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/4374/focus=6693 [^]
(0032942)
Brad King (manager)
2013-04-25 09:32

With the fix in 0010994:0032940 the cmake-bug.zip example is no longer expected to find the package because nothing tells find_package to look in prefix CMAKE_CURRENT_SOURCE_DIR. Adding

 list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})

to the example should tell find_package to look there. However, it still fails due to SystemTools::FileIsDirectory failing drive root paths like "z:/". The patch cmake-stat-drives.diff proposed here fixes that so I'm sending it to KWSys upstream:

 http://review.source.kitware.com/#/c/11031/ [^]

and will merge it back into CMake when ready.
(0032957)
Brad King (manager)
2013-04-29 10:20

Re 0010994:0032942: Fix for FileIsDirectory in KWSys imported to CMake here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=327c982f [^]
(0034039)
Robert Maynard (manager)
2013-10-07 10:09

Closing resolved issues that have not been updated in more than 4 months.

- Issue History
Date Modified Username Field Change
2010-07-15 04:58 Patrick Spendrin New Issue
2010-07-15 04:58 Patrick Spendrin File Added: cmake_current_list_file-bug.zip
2010-07-15 08:30 Patrick Spendrin File Added: cmake-bug.zip
2010-07-15 08:33 Patrick Spendrin Note Added: 0021396
2010-07-15 12:20 Patrick Spendrin File Added: cmake-stat-drives.diff
2010-07-15 15:37 Patrick Spendrin File Added: cmake-root-relative.diff
2010-07-15 15:43 Patrick Spendrin Note Added: 0021403
2011-01-05 19:25 David Cole Assigned To => David Cole
2011-01-05 19:25 David Cole Status new => assigned
2011-01-05 19:26 David Cole Relationship added related to 0011153
2011-10-25 22:25 David Cole Status assigned => backlog
2011-10-25 22:26 David Cole Assigned To David Cole =>
2013-03-08 08:04 Brad King Relationship added related to 0010072
2013-04-24 20:26 Chris Note Added: 0032936
2013-04-24 21:32 Chris Note Edited: 0032936 View Revisions
2013-04-24 23:36 Chris Note Added: 0032939
2013-04-25 09:22 Brad King Note Added: 0032940
2013-04-25 09:22 Brad King Assigned To => Brad King
2013-04-25 09:22 Brad King Status backlog => assigned
2013-04-25 09:22 Brad King Platform => Windows
2013-04-25 09:22 Brad King Summary get_filename_component ignores substituted drives => Windows: find_* commands can find paths with no drive letter
2013-04-25 09:27 Brad King Note Added: 0032941
2013-04-25 09:32 Brad King Note Added: 0032942
2013-04-29 10:20 Brad King Note Added: 0032957
2013-04-29 10:21 Brad King Status assigned => resolved
2013-04-29 10:21 Brad King Resolution open => fixed
2013-10-07 10:09 Robert Maynard Note Added: 0034039
2013-10-07 10:09 Robert Maynard Status resolved => closed


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker