[CMake] Building generated c++ code with py++ and boost.python
Filipe Sousa
filipe at ipb.pt
Wed Oct 11 07:00:28 EDT 2006
Pecevski Dejan wrote:
> Filipe Sousa wrote:
>
> Hi Filipe,
> Thanks for the reply.
> I have setup a simple example based on your solution, but it doesn't
> seem to work. Files of the example are attached to the e-mail.
> Basically in the example I am building a library libtest from these files:
> a.cpp - source for the library
> a.h - header file (it includes b.h)
> copy.h - generated header file by simple copying a.h. This file is
> included in a.cpp.
> b.h - file included in a.h
>
> The CMakeLists.txt is as follows:
> -------------------------------
> ADD_CUSTOM_COMMAND( OUTPUT copy.h
> COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/a.h
> ${CMAKE_CURRENT_SOURCE_DIR}/copy.h
> DEPENDS a.h
> )
>
> INCLUDE_DIRECTORIES( $CMAKE_CURRENT_SOURCE_DIR )
>
> ADD_LIBRARY( test a.cpp copy.h )
> ------------------------------
>
> The library builds ok, but the copy.h file is not really dependent of
> b.h, and it should be, because a.h includes it. So the question is, how
> to make
> this kind of dependency work?
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
)
fsousa at neptuno ~/tmp/example/cmake_example/build $ l
total 32
-rw-r--r-- 1 fsousa fsousa 9831 2006-10-11 11:56 CMakeCache.txt
drwxr-xr-x 4 fsousa fsousa 432 2006-10-11 11:56 CMakeFiles
-rw-r--r-- 1 fsousa fsousa 1445 2006-10-11 11:56 cmake_install.cmake
-rw-r--r-- 1 fsousa fsousa 4051 2006-10-11 11:56 Makefile
-rw-r--r-- 1 fsousa fsousa 4005 2006-10-11 11:56 Project.vpj
-rw-r--r-- 1 fsousa fsousa 241 2006-10-11 11:56 Project.vpw
-rw-r--r-- 1 fsousa fsousa 36 2006-10-11 11:56 Project.vpwhistu
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
fsousa at neptuno ~/tmp/example/cmake_example/build $ make
[100%] Built target test
fsousa at neptuno ~/tmp/example/cmake_example/build $ touch ../a.h
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
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
fsousa at neptuno ~/tmp/example/cmake_example/build $ cmake --version
cmake version 2.5-20061006
> And the other problem is that I don't know what is the list of generated
> wrapper c++ files, until they are generated, and I need the list
> to include it in a ADD_LIBRARY statement for the wrapper library.
>
> Is there a way to accomplish this?
>
> Thanks,
> Dejan
--
Filipe Sousa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20061011/bdc45edc/signature-0001.pgp
More information about the CMake
mailing list