Crni Gorac wrote: > Everything in my project, let's call it "foo", in pure ANSI C, except > that I'm using flex and bison for parsing input, then I need getopt() > function for processing program command line options and finally, I'm > using MPI library. Source code files are distributed between foo/lib > directory, where "libfoo" library was generated, and foo/src > directory, where executable "foo" was generated. My first question is > related exactly to these names, I wasn't able to find how to have a > library named "libfoo" and an executable named "foo" with cmake in > same project, so I had to rename executable to "bar"; thus my first > question would be: is something alike somehow possible with cmake?
Targets have to have unique *logical* names but you can use the OUTPUT_NAME property to change the *actual* name produced on disk: ADD_LIBRARY(foo ...) ADD_EXECUTABLE(foo-exe ...) SET_TARGET_PROPERTIES(foo-exe PROPERTIES OUTPUT_NAME foo) > Now, if anyone patient enough to read trough above CMakeLists.txt > files, I would be more than interested to hear is there anything that > could be improved. I have also two additional questions: Those look pretty nice to me. I'm glad you were able to produce that code in your first day of working with CMake. > 1. Besides foo/lib and foo/src directories, I have foo/data and > foo/doc directories, with some data files and program man page > (foo/doc/bar.1) respectively. How to structure CMakeLists.txt in > these directories in order to specify where to install these files > upon "make install"? Put a CMakeLists.txt file in the doc directory and an ADD_SUBDIRECTORY(doc) in the top CMakeLists.txt file. Then put this in doc/CMakeLists.txt: INSTALL(FILES bar.1 DESTINATION man/man1) > 2. I'm accustomed to having some rules added to program Makefiles, for > example to have "beauty" target to call indent upon my C source code. > How to accomplish this? See ADD_CUSTOM_TARGET and do not specify the ALL option. -Brad _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake