On Tuesday 28 September 2010, Alexander Neundorf wrote:
...
> Another option would be that I check in KDE/FPHSA.cmake
> CMAKE_PARENT_LIST_FILE to see whether KDE/FPHSA.cmake is included from a
> module in cmake or in KDE, and if it's in CMake, forward that explicitely
> to CMake/FPHSA.cmake. Unfortunately this doesn't seem work.
> I just added the following to the top of my local FPHSA.cmake:
>
> message(STATUS "parent: ${CMAKE_PARENT_LIST_FILE}")
> message(STATUS "current: ${CMAKE_CURRENT_LIST_FILE}")
>
> with the following in my CMakeLists.txt:
>
> set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
> find_package(DBusMenuQt)
> find_package(ZLIB)
>
>
> and hoped to see that I'm once include from
> ${CMAKE_SOURCE_DIR}/FindDBusMenuQt.cmake, and in the 2nd case from
> ${CMAKE_ROOT}/Modules/FindZLIB.cmake.
>
> But instead CMAKE_PARENT_LIST_FILE was always the CMakeLists.txt:
>
>
> -- parent: /home/alex/src/tests/cmake-fphsa/CMakeLists.txt
> --
> current:
> /home/alex/src/tests/cmake-fphsa/FindPackageHandleStandardArgs.cmake --
> parent: /home/alex/src/tests/cmake-fphsa/CMakeLists.txt
>
> Is this intended this way ?

The attached tiny patch seems to make CMAKE_PARENT_LIST_FILE work more like I 
expected.

Alex
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e32619a..e7138b1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -569,7 +569,7 @@ bool cmMakefile::ReadListFile(const char* filename_in,
     = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
   std::string currentFile
     = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE");
-  this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in);
+  this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentFile.c_str());
 
   const char* external = 0;
   std::string external_abs;
_______________________________________________
cmake-developers mailing list
[email protected]
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to