[CMake] How to set Overwrite or no over write in install(FILES ....)?

hce jupiter.hce at gmail.com
Mon Mar 11 01:14:01 EDT 2013


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.


More information about the CMake mailing list