[CMake] building source code generated using another project in cmake

Bill Hoffman bill.hoffman at kitware.com
Thu Jan 21 08:44:23 EST 2010


Chauhan, Vikas wrote:
> Hi,
> 
> I have a very interesting problem. It is described below.
> 
> I have two projects Proj1 & Proj2 under a top level root directory.
> 
> Now, the build steps are as follows:
> 
> 1.      Build Proj1 into Proj1.exe
> 2.      Execute Proj1.exe and it generates source1.cpp as an output (it 
> is a source file generator).
> 3.      source1.cpp is now included by Proj2
> 4.      Build proj2.exe
> 
> On the cmake GUI “Configure” works fine however “Generate” fails at the 
> root directory as Proj2 does not find the source1.cpp. Do you think we 
> can execute projects during build environment generation process i.e 
> between Proj1 & Proj2 ?
> 
> I guess that inside cmakelists.txt Proj2 can make sure that Proj1 runs 
> before Proj2 builds but what if Proj2 requires source files generated by 
> Proj1. How this can be made possible is the question.
> 
This might help:

http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_generate_an_executable.2C_then_use_the_executable_to_generate_a_file.3F

-Bill




-- 
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
bill.hoffman at kitware.com
http://www.kitware.com
518 881-4905 (Direct)
518 371-3971 x105
Fax (518) 371-4573


More information about the CMake mailing list