[CMake] Which variable stores all (sub) directories added sofar?

2011-05-19 Thread J.S. van Bethlehem

Hello,

Given that CMake errs when you try to some sub-directory twice using 
add_subdirectory() I presume there is some variable that stores a list 
of the directories that were added to the build sofar. But I can't find 
the name of the variable. Does it exists (well... better would be: is it 
visible to users) and if so, what is it called?


Yours sinceryl,
Jakob

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Which variable stores all (sub) directories added sofar?

2011-05-19 Thread Rolf Eike Beer
Am Donnerstag, 19. Mai 2011, 12:22:32 schrieb J.S. van Bethlehem:
 Hello,
 
 Given that CMake errs when you try to some sub-directory twice using
 add_subdirectory() I presume there is some variable that stores a list
 of the directories that were added to the build sofar. But I can't find
 the name of the variable. Does it exists (well... better would be: is it
 visible to users) and if so, what is it called?

I don't know the answer to your question, but:

I use a global property to store the absolute path of all subdirectories added 
by a macro. If this macro encounters that the requested subdirectory is 
already in the list it simply does nothing.

Eike

signature.asc
Description: This is a digitally signed message part.
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Which variable stores all (sub) directories added sofar?

2011-05-19 Thread J.S. van Bethlehem

On 05/19/2011 12:47 PM, Rolf Eike Beer wrote:

Am Donnerstag, 19. Mai 2011, 12:22:32 schrieb J.S. van Bethlehem:

Hello,

Given that CMake errs when you try to some sub-directory twice using
add_subdirectory() I presume there is some variable that stores a list
of the directories that were added to the build sofar. But I can't find
the name of the variable. Does it exists (well... better would be: is it
visible to users) and if so, what is it called?

I don't know the answer to your question, but:

I use a global property to store the absolute path of all subdirectories added
by a macro. If this macro encounters that the requested subdirectory is
already in the list it simply does nothing.

Eike

Hello Eike,

Thanks a lot for your reply. I have actually been thinking in the same 
direction. I have one problem though: how can you make a truly global 
variable in CMake? Whenever you do something to a variable in a 
directory that is added using add_subdirectory(), those changes don't 
propagate to the current directory
(well, one could use the PARENT_SCOPE option to set() in the 
sub-directory, but then I won't be able to test that sub-directory 
seperately because then CMake will err that there is no such scope)


How do you deal with this?

Greetsz, Jakob

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Which variable stores all (sub) directories added sofar?

2011-05-19 Thread Eric Noulard
2011/5/19 J.S. van Bethlehem j.s.van.bethle...@astro.rug.nl:

 Hello Eike,

 Thanks a lot for your reply. I have actually been thinking in the same
 direction. I have one problem though: how can you make a truly global
 variable in CMake? Whenever you do something to a variable in a directory
 that is added using add_subdirectory(), those changes don't propagate to the
 current directory
 (well, one could use the PARENT_SCOPE option to set() in the sub-directory,
 but then I won't be able to test that sub-directory seperately because then
 CMake will err that there is no such scope)

 How do you deal with this?

I think, that's why Eike uses **property** and not variable.

Property may be at GLOBAL scope:

set_property(GLOBAL|
   DIRECTORY [dir]   |
   TARGET[target1 [target2 ...]] |
   SOURCE[src1 [src2 ...]]   |
   TEST  [test1 [test2 ...]] |
   CACHE [entry1 [entry2 ...]]
  [APPEND]
  PROPERTY name [value1 [value2 ...]])

   Set one property on zero or more objects of a scope.  The first
   argument determines the scope in which the property is set.  It must
   be one of the following:

   GLOBAL scope is unique and does not accept a name.
...
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Which variable stores all (sub) directories added sofar?

2011-05-19 Thread Glenn Coombs
I think that you can use an environment variable rather than a normal
variable to bypass the normal scoping rules.  So:

set(ENV{foo} bar)

will I think allow other CMakeFiles to read it using:

$ENV{foo}

regardless of the sub-directory level.  I haven't tried using this so it may
not work but I think it should do what you want.

--
Glenn


On 19 May 2011 13:05, Eric Noulard eric.noul...@gmail.com wrote:

 2011/5/19 J.S. van Bethlehem j.s.van.bethle...@astro.rug.nl:
 
  Hello Eike,
 
  Thanks a lot for your reply. I have actually been thinking in the same
  direction. I have one problem though: how can you make a truly global
  variable in CMake? Whenever you do something to a variable in a directory
  that is added using add_subdirectory(), those changes don't propagate to
 the
  current directory
  (well, one could use the PARENT_SCOPE option to set() in the
 sub-directory,
  but then I won't be able to test that sub-directory seperately because
 then
  CMake will err that there is no such scope)
 
  How do you deal with this?

 I think, that's why Eike uses **property** and not variable.

 Property may be at GLOBAL scope:

 set_property(GLOBAL|
   DIRECTORY [dir]   |
   TARGET[target1 [target2 ...]] |
   SOURCE[src1 [src2 ...]]   |
   TEST  [test1 [test2 ...]] |
   CACHE [entry1 [entry2 ...]]
  [APPEND]
  PROPERTY name [value1 [value2 ...]])

   Set one property on zero or more objects of a scope.  The first
   argument determines the scope in which the property is set.  It must
   be one of the following:

   GLOBAL scope is unique and does not accept a name.
 ...
 --
 Erk
 Membre de l'April - « promouvoir et défendre le logiciel libre » -
 http://www.april.org
 ___
 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake