On 2007-11-16 11:49-0000 Stephen Collyer wrote:
I have a top-level cmake list file with this in it:OPTION (MDP_BUILD_SHARED_LIBS "Build Shared Libraries" ON) SET (LIB_TYPE STATIC) IF (MDP_BUILD_SHARED_LIBS) SET (LIB_TYPE SHARED) IF (WIN32) ADD_DEFINITIONS("-DMDP_BUILD_SHARED_LIBS") ENDIF (WIN32) ENDIF (MDP_BUILD_SHARED_LIBS) In a lower subdirectory, I have this to build a library: ADD_LIBRARY(Test ${LIB_TYPE} Test.cpp)
Bill has already given you a global way to set static or shared libraries, but what caught my eye here is that your LIB_TYPE was not propagating to lower directories as it should. I successfully use such propagation of variables all the time with ADD_SUBDIRECTORY. Are you using SUBDIRS instead? I don't use it, but I have heard it does things quite differently than ADD_SUBDIRECTORY. SUBDIRS is not officially deprecated yet, but the words about it in the man page indicate it is close to deprecation. 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 libLASi project (unifont.org/lasi); 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
