Re: [CMake] How to duplicate a source file and rename it

2018-09-21 Thread Ke Gao
It just can't copy to the same source directory. On Fri, Sep 21, 2018 at 4:32 PM J Decker wrote: > > > On Fri, Sep 21, 2018 at 3:29 PM J Decker wrote: > >> >> >> On Fri, Sep 21, 2018 at 3:24 PM Ke Gao wrote: >> >>> Thanks. I forgot to say my CMakeList.txt is not located together with >>> the s

Re: [CMake] How to duplicate a source file and rename it

2018-09-21 Thread J Decker
On Fri, Sep 21, 2018 at 3:29 PM J Decker wrote: > > > On Fri, Sep 21, 2018 at 3:24 PM Ke Gao wrote: > >> Thanks. I forgot to say my CMakeList.txt is not located together with the >> source files. So I used the following, it seems not working: >> add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_

Re: [CMake] How to duplicate a source file and rename it

2018-09-21 Thread J Decker
On Fri, Sep 21, 2018 at 3:24 PM Ke Gao wrote: > Thanks. I forgot to say my CMakeList.txt is not located together with the > source files. So I used the following, it seems not working: > add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../../aaa_file.c >DEPENDS $

Re: [CMake] How to duplicate a source file and rename it

2018-09-21 Thread Ke Gao
Thanks. I forgot to say my CMakeList.txt is not located together with the source files. So I used the following, it seems not working: add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../../aaa_file.c DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../file.c

Re: [CMake] How to duplicate a source file and rename it

2018-09-21 Thread J Decker
On Fri, Sep 21, 2018 at 3:00 PM Ke Gao wrote: > Hi, > > In a project, I need to first duplicate a source file and rename it. For > example, I want to change "file.c" to "aaa_file.c", and after compiling, I > will delete it. This is similar to using "cp file.c aaa_file.c". How to > easily do this

[CMake] How to duplicate a source file and rename it

2018-09-21 Thread Ke Gao
Hi, In a project, I need to first duplicate a source file and rename it. For example, I want to change "file.c" to "aaa_file.c", and after compiling, I will delete it. This is similar to using "cp file.c aaa_file.c". How to easily do this in CMake? I found "file" command doesn't work well for this