[CMake] CMAKE_CURRENT_SOURCE_DIR for modules

James Bigler jamesbigler at gmail.com
Tue Sep 30 11:43:47 EDT 2008


Sure, but how can I do this from within FindMyPackage.cmake?

Doing find_file(FindMyPackage.cmake PATHS ${CMAKE_MODULE_PATH}) seems
less robust than having a true mechanism to discover the path of a
file no matter where it was included from.

James

On Tue, Sep 30, 2008 at 7:24 AM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
> if you know where "FindMyPackage.cmake" is actually located then you can use
> the "GET_FILENAME_COMPONENT(...)" command to get its path then build out the
> rest of the path.
>
> Mike
>
>
> On Sep 30, 2008, at 8:45 AM, James Bigler wrote:
>
>> That's what I tried first, however CMAKE_CURRENT_SOURCE_DIR points to
>> where you called FIND_PACKAGE from and not from where the
>> FindMyPackage.cmake lives.
>>
>> James
>>
>> On Mon, Sep 29, 2008 at 5:03 PM, Michael Jackson
>> <mike.jackson at bluequartz.net> wrote:
>>>
>>> include(${CMAKE_CURRENT_SOURCE_DIR}/extrastuff.cmake)
>>>
>>> Just guessing but it seems like it should work..
>>>
>>> Mike
>>>
>>>
>>> On Sep 29, 2008, at 6:30 PM, James Bigler wrote:
>>>
>>>> Is it possible to include a file that is local to a module?
>>>>
>>>> I want to do this:
>>>>
>>>> FIND_PACKAGE(MyPackage)
>>>>
>>>> MyPackage.cmake:
>>>>
>>>> include(extrastuff.cmake)
>>>> ...
>>>>
>>>> The problem is that extrastuff.cmake isn't found.
>>>>
>>>> Thanks,
>>>> James
>>>> _______________________________________________
>>>> CMake mailing list
>>>> CMake at cmake.org
>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>
>


More information about the CMake mailing list