Andreas Stahl wrote > Hello Jupiter, > > can you post the error message here? I wasn't aware that install(FILES > ...) did any checking besides comparing the dates and overwriting if the > file to be installed is newer. > Also, you misunderstood what Petr meant. You need to escape the quotes in > the install(CODE "...") call, because you're effectively writing a string > to a file, i.e.: > > install(CODE " > if (NOT EXISTS \"${destination}/myfile.txt\") > install(FILES \"${source}/myfile.txt\" DESTINATION ${destination}) > endif() > ") > > BUT: using install inside an install command smells like problems, so you > better use the file(INSTALL...) directive, anyway: > > install(CODE " > if (NOT EXISTS \"${destination}/myfile.txt\") > file(INSTALL \"${source}/myfile.txt\" DESTINATION > \"${destination}\") > endif() > ") > > using the SCRIPT signature expects a cmake script file that will be > included in the cmake_install.cmake script file. This means you would need > to configure your paths in your cmakelists file > > configure_file(myfile_install.cmake.in myfile_install.cmake) > install(SCRIPT myfile_install.cmake) > > and in myfile_install.cmake.in you'd put > > if(NOT EXISTS "${destination}/myfile.txt") > file(INSTALL "${source}/myfile.txt" DESTINATION "${destination}") > endif() > > Hope that helps, > > Andreas
Ahh, that's tricky, the file(INSTALL ....) works. Thank you so much Andreas, and thanks Petr for your kind helps. Cheers. Jupiter -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-set-Overwrite-or-no-over-write-in-install-FILES-tp7583548p7583569.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