[CMake] Modules with additional files

Johannes Wienke jwienke at techfak.uni-bielefeld.de
Wed Dec 29 14:23:37 EST 2010


Am 29.12.2010 19:53 schrieb Michael Jackson:
> 
> --
> Mike Jackson <www.bluequartz.net>
> 
> On Dec 29, 2010, at 1:51 PM, Johannes Wienke wrote:
> 
>> Am 29.12.2010 19:22 schrieb Michael Jackson:
>>> You want to do something like this:
>>>
>>> # In the CMake file get the parent directory of the current
>>> # cmake file that is being parsed
>>> get_filename_component( CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} ABSOLUTE)
>>>
>>> configure_file ( ${CURRENT_DIR}/SomeFile.h.in  ...... )
>>>
>>> Is that what you were looking for? 
>>
>> The problem is that I am not in a list file, but in a module. Hence,
>> CMAKE_CURRENT_LIST_FILE does not work.
>>
>> For example I got a module that test some features using a cpp file that
>> needs to be try-compiled and I now need a way to locate this cpp-file.
>> All default cmake modules use something like CMAKE_ROOT, but I cannot
>> assume this.
>>
>> Regards,
>> Johannes
>>
> I don't understand what you mean by a "module". If you are in a CMakeLists.txt or *.cmake file that is being parsed by CMake then you have access to CMAKE_CURRENT_LIST_FILE. I think I am missing something about your particular setup. Maybe some more details would help us. 

Confusing, I thought I checked this twice that CMAKE_CURRENT_LIST_*
always only points to CMakeLists.txt files, but it works perfectly. ;)

Thanks alot, I must have been really tired. ;)

Cheers,
Johannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101229/3ec093c3/attachment.pgp>


More information about the CMake mailing list