[CMake] Modules with additional files

Michael Jackson mike.jackson at bluequartz.net
Wed Dec 29 13:53:25 EST 2010


--
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. 

___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net 
BlueQuartz Software               Dayton, Ohio



More information about the CMake mailing list