[CMake] CMAKE_CURRENT_SOURCE_DIR for modules

James Bigler jamesbigler at gmail.com
Wed Oct 1 14:05:16 EDT 2008


I filed a bug about this
(http://public.kitware.com/Bug/view.php?id=7757), and Bill told me
about CMAKE_CURRENT_LIST_FILE.

       CMAKE_CURRENT_LIST_FILE
              Full path to the listfile currently being processed.

              As CMake processes the listfiles in your project  this  variable
              will  always  be  set  to the one currently being processed. See
              also CMAKE_PARENT_LIST_FILE.

Using this and GET_FILENAME_COMPONENT, I was able to pull out the path
to the module.

Thanks,
James

On Tue, Sep 30, 2008 at 9:57 AM, James Bigler <jamesbigler at gmail.com> wrote:
> Thannks, I just noticed this from poking around the documentation.
>
> This helps when including cmake scripts, but if I want to do a
> configure_file(somefile...), I'll need the path to my scripts.
>
> James
>
> On Tue, Sep 30, 2008 at 9:46 AM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
>> James Bigler wrote:
>>>
>>> Sure, but how can I do this from within FindMyPackage.cmake?
>>>
>>
>> Leave off the .cmake.
>>
>>
>> include(extrastuff)
>>
>> should work if CMAKE_MODULE_PATH is set correctly.
>>
>> -Bill
>>
>


More information about the CMake mailing list