[CMake] configure_file behaves differently on Mac and Linux?

Bill Hoffman bill.hoffman at kitware.com
Thu Oct 22 08:27:34 EDT 2009


James C. Sutherland wrote:
> I am using configure_file to copy files during the build process.  I 
> have a nested directory structure, that can be represented as:
> 
>     /rootdir
>       CMakeLists.txt
>       /test
>          CMakeLists.txt
> 
> 
> When processing rootdir/test/CMakeLists.txt, I have the following:
> 
>     #---------------------------
> 
>     get_filename_component( dir ${CMAKE_CURRENT_LIST_FILE} PATH )
>     configure_file( ${dir}/blessed.txt blessed.txt COPY_FILE )
> 
>     #---------------------------

This should work:

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/blessed.txt 
${CMAKE_CURRENT_BINARY_DIR}/blessed.txt COPY_ONLY)

Not sure why yours does not work, some message statements might show 
what is going on...


-Bill


More information about the CMake mailing list