[cmake-developers] [CMake 0014194]: CMAKE_PARENT_LIST_FILE has wrong value.

Mantis Bug Tracker mantis at public.kitware.com
Tue Jun 4 05:46:34 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14194 
====================================================================== 
Reported By:                Yichao Yu
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14194
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-06-04 05:46 EDT
Last Modified:              2013-06-04 05:46 EDT
====================================================================== 
Summary:                    CMAKE_PARENT_LIST_FILE has wrong value.
Description: 
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.

Steps to Reproduce: 
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 == ....

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-06-04 05:46 Yichao Yu      New Issue                                    
======================================================================




More information about the cmake-developers mailing list