<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv2123885337">Thanks Michael for your reply.<br>I should have mentioned that every time I run 'make' (not cmake) I want to copy file only if <br>the original file in the source directory has changed.<br><br>I tried your suggestion, it works on cmake 2.4 but it still doesn't work on cmake 2.6<br>mladhe@linux:~/cmake_expt/bld] make<br>Built target sample.bash<br>mladhe@linux:~/cmake_expt/bld] ls<br>CMakeCache.txt CMakeFiles Makefile cmake_install.cmake<br><br>So though it says 'Built target sample.bash', the file has not been copied.<br>Also I believe CONFIGURE_FILE(... COPYONLY) will copy file only when running<br>'cmake' and not when running 'make'<br><br>I googled, but didn't find a solution that will work on both cmake versions.<br><br>Thanks,<br>Mahendra<br><br>--- On <b>Thu, 24/12/09, Michael Wild
<i><themiwi@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Michael Wild <themiwi@gmail.com><br>Subject: Re: [CMake] Simple CMakeLists.txt file not working with cmake version 2.6<br>To: "Mahendra Ladhe" <lml108@yahoo.com><br>Cc: cmake@cmake.org<br>Date: Thursday, 24 December, 2009, 1:06 AM<br><br><div class="plainMail"><br>On 24. Dec, 2009, at 9:26 , Mahendra Ladhe wrote:<br><br>> Hi,<br>> shown below is a simplified and relevant part of my CMakeLists.txt file.<br>> <br>> add_custom_command
(<br>> OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sample.bash<br>> DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sample.bash<br>> COMMAND cp ARGS -f ${CMAKE_CURRENT_SOURCE_DIR}/sample.bash .)<br><br>make the last line<br><br> COMMAND "${CMAKE_COMMAND}" -E copy_if_different<br> "${CMAKE_CURRENT_SOURCE_DIR}/sample.bash"<br> "${CMAKE_CURRENT_BINARY_DIR}/sample.bash")<br><br>However, if it really is only copying you are interested in, why don't you use CONFIGURE_FILE(... COPYONLY)?<br><br>> <br>> add_custom_target (sample.bash ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/sample.bash)<br><br>I don't see why you want this... In any case, you need to rename this custom target, because it probably clashes with the custom command.<br><br>> <br>> Basically, I want to copy the 'sample.bash' script from source directory to the<br>>
binary (build) directory when 'make' is run.<br>> I want this CMakeLists.txt to work on cmake version 2.4 as well as 2.6<br>> <br>> On cmake 2.4, this works fine.<br>> mladhe@linux:~/cmake_expt/bld] make<br>> [ 0%] Generating sample.bash<br>> [100%] Built target sample.bash<br>> mladhe@linux45:~/cmake_expt/bld] ls<br>> CMakeCache.txt CMakeFiles Makefile cmake_install.cmake sample.bash<br>> <br>> However on cmake 2.6, I get the following.<br>> <br>> mladhe@linux:~/cmake_expt/bld] make<br>> Scanning dependencies of target sample.bash<br>> make[2]: Circular CMakeFiles/sample.bash <- sample.bash dependency dropped.<br>> Built target sample.bash<br>> mladhe@linux45:~/cmake_expt/bld] ls<br>> CMakeCache.txt CMakeFiles Makefile cmake_install.cmake<br>> <br>> As can be seen, sample.bash file has not been copied.<br>> <br>> How to make this
CMakeLists.txt work on both cmake versions ?<br>> <br>> Thank you,<br>> Regards,<br>> Mahendra Ladhe<br>> <br><br>HTH<br><br>Michael<br><br></div></blockquote></div></td></tr></table><br>
<!--1--><hr size=1></hr>
The INTERNET now has a personality. YOURS! <a href="http://in.rd.yahoo.com/tagline_yyi_1/*http://in.yahoo.com/" target="_blank">See your Yahoo! Homepage</a>.