Hi Jupiter,

regarding your second question: you'd need to escape the nested
quotes. Also, I'm not sure if 'not exists' can be given in lowercase.

However, I'd strongly suggest using install(SCRIPT ...) instead of
install(CODE ...), precisely because of the escaping issues.

Petr

On Mon, Mar 11, 2013 at 6:14 AM, hce <jupiter....@gmail.com> wrote:
> Hi,
>
> I have following statement to install a file from source directory to
> destination. It got a conflict error if the destination has already had the
> file.
>
> install(FILES "${source}/myfile.txt" DESTINATION ${destination})
>
> Is there anyway to set either overwrite, or no overwrite if the file exists?
> Or any workaround to stop the conflict error?
>
> I also tried following code, but I've got syntax error, if the install(CODE
> ..) can make it work, could you please correct my following code?
>
> install(CODE "
>     if (not exists "${destination}/myfile.txt")
>         install(FILES "${source}/myfile.txt" DESTINATION ${destination})
>     endif()
> ")
>
> Thank you.
>
> Kind regards,
>
> Jupiter
>
>
>
>
> --
> View this message in context: 
> http://cmake.3232098.n2.nabble.com/How-to-set-Overwrite-or-no-over-write-in-install-FILES-tp7583548.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> 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
--

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

Reply via email to