[CMake] Building generated c++ code with py++ and boost.python

Pecevski Dejan dejan at igi.tugraz.at
Wed Oct 11 08:46:43 EDT 2006


Hi again,

Filipe Sousa wrote:

>ADD_CUSTOM_COMMAND(
>  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/copy.h
>  COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/a.h
>${CMAKE_CURRENT_BINARY_DIR}/copy.h
>  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/a.h
>  )
>INCLUDE_DIRECTORIES(
>  ${CMAKE_CURRENT_BINARY_DIR} # for copy.h
>  ${CMAKE_CURRENT_SOURCE_DIR} # becasuse copy.h needs b.h
>  )
>ADD_LIBRARY(test
>  a.cpp
>  ${CMAKE_CURRENT_BINARY_DIR}/copy.h
>  a.h
>  )
>
>  
>
--------- snip ------------

>fsousa at neptuno ~/tmp/example/cmake_example/build $ touch ../b.h
>
>fsousa at neptuno ~/tmp/example/cmake_example/build $ make
>Scanning dependencies of target test
>[ 50%] Building CXX object CMakeFiles/test.dir/a.o
>Linking CXX static library libtest.a
>[100%] Built target test
>  
>
In this case, the correct output should be:

fsousa at neptuno ~/tmp/example/cmake_example/build $ make
[ 50%] Generating copy.h
Scanning dependencies of target test
[100%] Building CXX object CMakeFiles/test.dir/a.o
Linking CXX static library libtest.a
[100%] Built target test

Copy.h is dependent on a.h, which is then dependent on b.h, so copy.h should be regenerated as well, but it is not.


>fsousa at neptuno ~/tmp/example/cmake_example/build $ cmake --version
>cmake version 2.5-2006100
>  
>
My version is cmake-2.4-patch3.

Dejan





More information about the CMake mailing list