From: Alan W. I. <ir...@be...> - 2007-04-06 18:45:00
|
On 2007-04-06 10:41-0700 winson wrote: > With the information from the build log, I have > managed to generate file "plhershey-unicode.h" by > launching plhershey-unicode.exe with parameters on > command-line. Then I copied the file manually to the > "include" directory. My question now is, is it what > this perticular build process all about? Yes. > In other > words, will the file "plhershey-unicode.h" affect the > subsequent build of other files? I looked through > other "CMakeLists.txt" files, it seems okay. But I am > not sure. Thanks. The short answer was above, but if you want to follow the logic (which is actually pretty easy to do if you also look at the CMake documentation at http://cmake.org/HTML/Documentation.html) the relevant section of CMake logic is as follows: add_executable(plhershey-unicode-gen ${plhershey-unicode-gen_SRCS}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h COMMAND ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode-gen${EXEEXT} ${CMAKE_SOURCE_DIR}/fonts/plhershey-unicode.csv plhershey-unicode.h DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode-gen${EXEEXT} ${CMAKE_SOURCE_DIR}/fonts/plhershey-unicode.csv ) # For cross-directory dependencies.... add_custom_target( plhershey-unicode.h_built DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h ) This is the implementation of an important chain of dependencies. The custom command depends on the add_executable via the DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode-gen${EXEEXT}. In turn, the custom target depends on the custom command via DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h. Furthermore, if you look at src/CMakeLists.txt, you will see our core library depends on the above custom target via the add_dependencies(plplot${LIB_TAG} plhershey-unicode.h_built) command. Through this chain of dependencies, the timing of various builds is enforced. ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode-gen${EXEEXT} always gets built first, then ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h is built, then finally the plplot${LIB_TAG} core library is built in the build tree. Also, and just as important, no unnecessary builds of ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode-gen${EXEEXT}, ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h, or the library are done. If you are trying to mimic any of this by hand (due to some platform problem), then be sure to keep the same order and place your results in the appropriate build-tree subdirectory (which normally is separate from the corresponding source tree directory). Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |