[Cmake] Targets, Output Files, Command Lines

William A. Hoffman billlist at nycap.rr.com
Mon Aug 9 14:26:23 EDT 2004


I don't think you want this:
LINK_LIBRARIES(bit_streamer)

Also, I would recommend using 
bit_streamer_SOURCE_DIR nad
bit_streamer_BINARY_DIR instead of hard coding the R: path.

Also, the use of $\(InputDir\) $\(InputPath\) in your custom
command will restrict this to only work with visual studio project
files.  The nmake, and unix generation will not work with those.


-Bill




At 02:10 PM 8/9/2004, you wrote:
>Bill,
>
>        Yes that was exactly what I needed. The form of the VS Project
>is now practically identical to that of the original. Thank you so much!
>Only one problem remains. I get a lot of "Unresolved External Symbol"
>and "value Already Defined" errors from my .obj files. I'm guessing I'm
>just missing one more step. Ill reupdate the code so you can see where I
>stand now.
>
>http://rain.prohosting.com/ekaid/CmakeLists.txt
>
>Thanks,
>Andy
>
>-----Original Message-----
>From: William A. Hoffman [mailto:billlist at nycap.rr.com] 
>Sent: Monday, August 09, 2004 1:29 PM
>To: Andrew Dupont
>Cc: cmake at www.cmake.org
>Subject: RE: [Cmake] Targets, Output Files, Command Lines
>
>OK, I think I have found the source of your problems.
>You have a case that is not directly covered by cmake or the
>cmake book.  You have the case where a generator program 
>is generating multiple source files as output.  Currently,
>the ADD_CUSTOM_COMMAND command does not directly support more
>than one file as output.  However, there is a way to do this
>in the current cmake.  I have added an example of how to do 
>this in the CMake FAQ, question 2.4:
>
>http://www.cmake.org/Wiki/CMake_FAQ
>
>
>Basically, you want something like this:
>
>For each of your .g files do something like this:
>
>ADD_CUSTOM_COMMAND(OUTPUT
>${bit_streamer_BINARY_DIR}/AddressTableParser.cpp 
>  COMMAND java
>  ARGS -classpath ${THIRD_PARTY_PATH}lib/vc/antlr.jar antlr.Tool -o
>${bit_streamer_BINARY_DIR}   ${bit_streamer_SOURCE_DIR}/AddressTable.g
>  MAIN_DEPENDENCY ${bit_streamer_SOURCE_DIR}/AddressTable.g
>  )
>
>Then add a dummy custom command for each of the outputs produced by
>antlr and
>have each of them depend on this first output.
>
>ADD_CUSTOM_COMMAND(OUTPUT
>${bit_streamer_BINARY_DIR}/AddressTableParser.hpp
>  COMMAND echo
>  DEPENDS ${bit_streamer_BINARY_DIR}/AddressTableParser.cpp
>  )
>ADD_CUSTOM_COMMAND(OUTPUT
>${bit_streamer_BINARY_DIR}/AddressTableLexer.hpp
>  COMMAND echo
>  DEPENDS ${bit_streamer_BINARY_DIR}/AddressTableParser.cpp
>  )
>
>ADD_CUSTOM_COMMAND(OUTPUT
>${bit_streamer_BINARY_DIR}/AddressTableLexer.cpp
>  COMMAND echo
>  DEPENDS ${bit_streamer_BINARY_DIR}/AddressTableParser.cpp
>  )
>
>-Bill
>
>At 10:19 AM 8/9/2004, Andrew Dupont wrote:
>>Bill,
>>
>>        Sorry I haven't given you good information up to this point, I
>>was basically working blind on trying to produce this Makfile and VS
>>project. The .g files are given to antlr and run using a custom command
>>that should go to the command prompt. Antlr then produces a list of
>>.hpp, .h and a single .txt file, which are needed for the build of the
>>bit_streamer. I need to add the dependency on each .g file with all of
>>the .hpp and .h outputs so every time the project is built, antlr is
>>called and produces the desired header files.
>>
>>Thanks,
>>Andy



More information about the Cmake mailing list