[CMake] library name from subdirectory and setting the CACHE - a "listening" variable?

Eric Noulard eric.noulard at gmail.com
Wed Jul 28 15:44:02 EDT 2010


2010/7/28 Clifford Yapp <cliffyapp at gmail.com>:
> Ironically, I now see this issue (almost exactly) was discussed long ago:
>
> http://www.cmake.org/pipermail/cmake/2005-September/007204.html
>
> However, when I try:
>
> get_directory_property(PNG_LIB_NAME DIRECTORY src/other/libpng
> DEFINITION PNG_LIB_NAME)
> MESSAGE("getdirprop: ${PNG_LIB_NAME}")
>
> I get nothing - anybody have a worked example using this feature?

I must admit I did not read your previous mail entirely but
did you notice that:

get_directory_property
       Get a property of DIRECTORY scope.
 [...]
      The specified directory must have already been
       traversed by CMake.

That is if the parent is retrieving daugther directory property BEFORE
the daughter was traversed then you won't get anything.

As far as I understand "add_subdirectory" doc, the subdirectory are traversed
"in-depth" first since
"The CMakeLists.txt file in the specified source
       directory will be processed immediately by CMake before processing in
       the current input file continues beyond this command."

so if want to get_directory_property from a daughter dir then you
ensure that add_subdirectory to the target dir appear before
get_directory_property.

Is it the case in your example?

Do you have a small example which exhibit the "get_directory_property" issue?
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list