[CMake] Scope of a macro

Robert Dailey rcdailey at gmail.com
Tue Mar 3 21:47:57 EST 2009


I'm not doing that at all. Apologies for lack of detail.

For example, I will have the following:

foo/bar/CMakeLists.txt

This file has the macro definition in it.

Now in:
foo/baz/something/CMakeLists.txt

I'm able to call the macro defined in the first CMakeLists.txt file. The
only connection between all of these CMakeLists.txt files are
add_subdirectory() commands. How can I figure out where the macro is coming
from? I'm not sure how CMake is finding it.

On Tue, Mar 3, 2009 at 8:00 PM, Michael Jackson <mike.jackson at bluequartz.net
> wrote:

> I will assume you are doing something like this:
>
> include(/path/to/file/with/macros.cmake)
> mymacro(args)
>
> The easiest way to think of "include" is the same as a C/C++ #include.
> CMake will take the contents of the file and "place" it inline in the cmake
> file that is using the 'include' command. In that respect there is no
> "scope". As long as CMake can open the file it can be included.
>
>
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
>
>
>
> On Mar 3, 2009, at 8:50 PM, Robert Dailey wrote:
>
>  Hi,
>>
>> I've got the following directory structure on Windows:
>>
>> project/source/foo
>> project/bar/stuff
>>
>> In the first directory, I have a CMakeLists.txt which defines a macro.
>> However, I am able to call that from the CMakeLists.txt inside of the second
>> directory. Does the scope of a macro not respect directory location/depth?
>> I'm using CMake version 2.6.3.
>> _______________________________________________
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090303/a37353d7/attachment-0001.htm>


More information about the CMake mailing list