[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: Re: [CMake] copy_if_different on build
From: Skippy VonDrake <skippyvondrake () gmail ! com>
Date: 2013-03-29 21:07:24
Message-ID: CAAj=x+Moj=Bta+TKpA-wRurs8OwhQm_TFrd8WAqYmW494F9bug () mail ! gmail ! com
[Download RAW message or body]
>> I'm using:
>> execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
>> <some-file> <some-dest-dir>)
>>
>> Should the file be copied when:
>> the file has changed AND a build is executed?
>> Or
>> the file has changed AND CMakeLists.txt has changed AND a build is
>> executed?
>>
>> Only the 2nd method (when the CMakeLists.txt file is touched) results in
>> the
>> changed file being copied.
>>
>> I'd expect the 1st method to also cause a file copy.
>> If this assumption is wrong please tell me why.
>
>
> execute_process is a configure step. It does not create build rules and will
> ONLY execute when CMake is run.
>
> If you want to create a build rule, use add_custom_command or
> add_custom_target instead.
>
> Anyway, the above is silly; if you really only wanted the file copied at
> cmake time, you should instead use configure_file(... COPY_ONLY) :-) rather
> than unnecessarily invoking an extra process.
I'll look closer at add_custom_command. I want the file to copy over if
it has changed - at build time. Not cmake time. And not copy if it hasn't
changed. But that may not be doable.
Seems like every StackOverflow post I see has a different take on how
to do this simple process.
--
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic