MantisBT - CMake
View Issue Details
0014194CMakeCMakepublic2013-06-04 05:462013-11-04 09:33
Yichao Yu 
Brad King 
normalminoralways
closedfixed 
LinuxArch Linux
CMake 2.8.11 
CMake 2.8.12CMake 2.8.12 
0014194: CMAKE_PARENT_LIST_FILE is not clearly documented
In the documentation of the variable it says,
    this variable will always be set to the listfile that included or somehow invoked the one currently being processed.

since AFAIK include and add_subdirectory are the most common ways to "include or somehow invoke" a list file, add_subdirectory should be included in "somehow invoked".

However, in a CMakeLists.txt that is "included or somehow invoked" by add_subdirectory, CMAKE_PARENT_LIST_FILE is always the same with CMAKE_CURRENT_LIST_FILE. I'm not sure if this is a bug in cmake or the document, but I think either the variable should be set to the list file that `add_subdirectory` the current list file, or it should be more clear in the documentation that the variable is the same with CMAKE_CURRENT_LIST_FILE for CMakeLists.txt's that are add_subdirectory'd.
if(CMAKE_CURRENT_LIST_FILE STREQUAL CMAKE_PARENT_LIST_FILE)
  message("CMAKE_CURRENT_LIST_FILE == CMAKE_PARENT_LIST_FILE")
else()
  message("CMAKE_CURRENT_LIST_FILE != CMAKE_PARENT_LIST_FILE")
endif()

for files that are include'd it always prints != (well unless it is a self include.....) for files that are add_subdirectory'd it always prints == ....
No tags attached.
Issue History
2013-06-04 05:46Yichao YuNew Issue
2013-06-04 08:25Brad KingNote Added: 0033223
2013-06-04 08:25Brad KingAssigned To => Brad King
2013-06-04 08:25Brad KingStatusnew => resolved
2013-06-04 08:25Brad KingResolutionopen => fixed
2013-06-04 08:25Brad KingFixed in Version => CMake 2.8.12
2013-06-04 08:25Brad KingTarget Version => CMake 2.8.12
2013-06-04 08:25Brad KingSummaryCMAKE_PARENT_LIST_FILE has wrong value. => CMAKE_PARENT_LIST_FILE is not clearly documented
2013-11-04 09:33Robert MaynardNote Added: 0034361
2013-11-04 09:33Robert MaynardStatusresolved => closed

Notes
(0033223)
Brad King   
2013-06-04 08:25   
Documentation clarified:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b62d440e [^]
(0034361)
Robert Maynard   
2013-11-04 09:33   
Closing resolved issues that have not been updated in more than 4 months.