On 2006-10-06 14:35-0400 Bill Tonkin wrote:
The directory layout is:/users/wmt/cmake_system/ | systems/my_one/ | | | CMakeLists.txt [1] | main.C | libraries/my_a/ | | | CMakeLists.txt [2] | my_a.C | my_a.h | | cmake_build/ | systems/my_one/ | | | CMakeCache.txt | libraries/my_a/
I haven't followed your error messages and results in detail, but I believe what you are trying to do (only have CMakeLists.txt files in subdirectories of the source tree and run cmake from a subdirectory of the build tree) is the source of the problem, and there is a straightforward way to build your projct using a top-level style approach where everything starts in the top-level source tree and cmake is run from the top-level build tree. Here is what you do to change to that "top-level" style (which works well for me). Create a top-level CMakeLists.txt file in /users/wmt/cmake_system/ which contains the following: project (my_one) add_subdirectory(libraries/my_a) add_subdirectory(systems/my_one) The contents of libraries/my_a/CmakeLists.txt should continue to be add_library (my_a my_a.C) The contents of systems/my_one/CmakeLists.txt should be changed to add_executable (my_one_exe main.C) target_link_libraries (my_one_exe my_a) Note, that last command refers to a target created in a different subdirectory, but that is fine, target information is universal in CMake (so long as the subdirectory that creates the target is processed before subdirectories that refer to it as in the top-level CMakeLists.txt above. Then completely clean out your old build tree since cmake and make create everything there, and you don't want past bad attempts to confuse issues. rm -rf /users/wmt/cmake_system/cmake_build Then build your project from the top-level of the build tree. mkdir /users/wmt/cmake_system/cmake_build cd /users/wmt/cmake_system/cmake_build cmake ../ make Note how the cmake command refers specifically to the top-level directory of the source tree where the top-level CMakeLists.txt file exists. Hope this helps. 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 __________________________ _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
