[CMake] Simple CMakeLists.txt file not working with cmake version 2.6

Mahendra Ladhe lml108 at yahoo.com
Thu Dec 24 03:26:35 EST 2009


Hi,
  shown below is a simplified and relevant part of my CMakeLists.txt file.

add_custom_command (
  OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/sample.bash
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sample.bash
  COMMAND cp ARGS -f  ${CMAKE_CURRENT_SOURCE_DIR}/sample.bash .)

add_custom_target (sample.bash ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/sample.bash)

  Basically, I want to copy the 'sample.bash' script from source directory to the
binary (build) directory when 'make' is run.
I want this CMakeLists.txt to work on cmake version 2.4 as well as 2.6

On cmake 2.4, this works fine.
mladhe at linux:~/cmake_expt/bld] make
[  0%] Generating sample.bash
[100%] Built target sample.bash
mladhe at linux45:~/cmake_expt/bld] ls
CMakeCache.txt  CMakeFiles  Makefile  cmake_install.cmake  sample.bash

However on cmake 2.6, I get the following.

mladhe at linux:~/cmake_expt/bld] make
Scanning dependencies of target sample.bash
make[2]: Circular CMakeFiles/sample.bash <- sample.bash dependency dropped.
Built target sample.bash
mladhe at linux45:~/cmake_expt/bld] ls
CMakeCache.txt  CMakeFiles  Makefile  cmake_install.cmake

As can be seen, sample.bash file has not been copied.

How to make this CMakeLists.txt work on both cmake versions ?

Thank you,
Regards,
Mahendra Ladhe





      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091224/624fa5a4/attachment.htm>


More information about the CMake mailing list