MantisBT - CMake
View Issue Details
0002797CMakeCMakepublic2006-01-30 16:482006-01-31 10:47
Alex Neundorf 
Brad King 
normalmajoralways
closedfixed 
 
 
0002797: GET_FILENAME_PROPERTY(... ABSOLUTE) works only from CMAKE_SOURCE_DIR
Hi,

GET_FILENAME_COMPONENT(absPath main.c ABSOLUTE)
always assumes that the filename given is relative to CMAKE_SOURCE_DIR, not relative to CMAKE_CURRENT_SOURCE_DIR. This means that with the following dir structure:

~/src/CMakeLists.txt
~/src/sub/CMakeLists.txt
~/src/sub/main.c

if src/sub/CMakeLists.txt contains
GET_FILENAME_COMPONENT(absPath main.c ABSOLUTE)
it "returns" src/main.c instead of src/sub/main.c .
Attached you can find a simple testcase.

Alex
No tags attached.
gz cmake_abs_path.tar.gz (340) 1969-12-31 19:00
https://public.kitware.com/Bug/file/450/cmake_abs_path.tar.gz
Issue History

Notes
(0003627)
Brad King   
2006-01-31 09:52   
I'm assigning this bug to myself.
(0003642)
Brad King   
2006-01-31 10:47   
I've put in a fix:

/cvsroot/CMake/CMake/Source/cmGetFilenameComponentCommand.cxx,v <-- cmGetFilenameComponentCommand.cxx
new revision: 1.14; previous revision: 1.13

Please reopen the bug if it doesn't work.