View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012265CMakeCMakepublic2011-06-10 17:522012-01-02 15:56
ReporterStephen Kelly 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0012265: ${CMAKE_CURRENT_LIST_DIR} called from a macro or function does not refer to the current directory
DescriptionThis might be fully intentional, but I noticed that inside and macro or function the ${CMAKE_CURRENT_LIST_DIR} refers to the caller.

I found a workaround by setting a variable in the top level. Is this a bug or is there another variable I should use?
TagsNo tags attached.
Attached Filesgz file icon cmakelistdir.tar.gz [^] (1,715 bytes) 2011-06-10 17:52

 Relationships

  Notes
(0026845)
Alex Neundorf (developer)
2011-06-13 04:48
edited on: 2011-06-13 05:08

It behaves the same way as ${CMAKE_CURRENT_LIST_FILE}, so this behaviour is intentional.
I can remember there were discussion(s) about this on the cmake or cmake-developers mailing list, and this was the outcome. Can't remember the details though.

Alex

(0027127)
Brad King (manager)
2011-07-29 18:19

The behavior is as intended.

The workaround you propose is already in common usage. Typically if I'm writing a module "MyModule.cmake" then I will put code at the top like

  get_filename_component(_MyModule_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)

which is the pre-2.8.3 equivalent to

  set(_MyModule_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})

so I can refer to the module location inside functions or macros later.
(0028116)
David Cole (manager)
2012-01-02 15:56

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

 Issue History
Date Modified Username Field Change
2011-06-10 17:52 Stephen Kelly New Issue
2011-06-10 17:52 Stephen Kelly File Added: cmakelistdir.tar.gz
2011-06-13 04:48 Alex Neundorf Note Added: 0026845
2011-06-13 05:08 Alex Neundorf Note Edited: 0026845
2011-07-29 18:19 Brad King Note Added: 0027127
2011-07-29 18:19 Brad King Status new => resolved
2011-07-29 18:19 Brad King Resolution open => no change required
2011-07-29 18:19 Brad King Assigned To => Brad King
2012-01-02 15:56 David Cole Note Added: 0028116
2012-01-02 15:56 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team