On 2013-03-03 14:17-0800 phil rosenberg wrote:
Regarding CMake stuff. It's actually CMAKE_C_FLAGS_RELEASE and the
Debug and C++ equivalents that need to be used to swap the /MD compile flag with /MT and the /MDd for /MTd. I think it's a compile flag because the name mangling and/or header files or perhaps something else is different - anyway we end up with different named functions in the compiled files. I've tried dimply adding /MT to the flags but this doesn't work. I don't know why. In online examples I've seen they change the flags in the build system e.g. Apache http://svn.apache.org/repos/asf/tcl/rivet/branches/threaded-mpm/CMakeLists.txt.There are a few paragraphs on the CMAKE FAQ, but they don't mean a great deal to me as I don't know CMAKE well - look for "How can I build my MSVC application with a static runtime?" at http://www.cmake.org/Wiki/CMake_FAQ.
Thanks for that reference to the FAQ. It appears this idea works for you (and presumably Apache). However, my first reaction was I did not like this low-level brute-force approach, but when looking for additional alternatives I came across these two interesting recent posts by Brad King (a CMake expert) at http://public.kitware.com/pipermail/cmake-developers/2012-April/003798.html and http://public.kitware.com/pipermail/cmake-developers/2012-April/003840.html. It appears I have been conflating two issues which are (1) specifying static or shared language runtime libraries (which I believe is what the above low-level "FAQ" approach deals with for a very specific Windows compiler case), and (2) specifying a static or shared choice for required external library dependencies (such as the wxWidgets library). Furthermore, from Brad's comments it appears that (1) has not been implemented yet by CMake so the above low-level "FAQ" approach for doing the same thing appears to be the only way to go at this time. <aside> I am quite interested in (2) as a way to reduce PLplot dependencies on external libraries. However, from Brad's remarks such implementation would require different CMake code for each different platform. In fact, we already do have this implemented for Unix platforms for the static library case (see the FORCE_EXTERNAL_STATIC option), but I haven't tested that option in a while so it might not currently work). And I certainly don't know of any way to do the same thing on Windows. </aside> Getting back to your patch (which uses the above FAQ approach) one thing I dislike about it is how you have to repeat that logic for each directory. Could you try my attached patch instead? For that patch I do the equivalent of your C and CXX flag changes in just one place and include the important additional CMake command: set(${flag_var} "${${flag_var}}" CACHE STRING "Flags used by the compiler" FORCE) Essentially what the FAQ approach does is attempt to overwrite cachedvariables, and the above addition to that logic makes sure that overwriting is done
properly for these cached variables. Anyhow, I think the above change will allow the logic to be done just once (as in the attached patch) rather than in each relevant directory. The attached patch caused me no problems for MinGW on Wine but because the compiler flags had no instances of /MD it is not a real test of the patch like you can supply.(For further MinGW /MD etc., comments see http://lists-archives.com/mingw-users/00126-mingw-msvc-md-mt-ml.html.)
If the attached patch satisfies your /MT needs (when you specify -DSTATIC_RUNTIME=ON as a cmake option) for your particular Windows compiler, I will commit it. 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); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); 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 __________________________
plplot.cmake.patch.gz
Description: patch which should satisfy /MT needs for Windows compilers
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________ Plplot-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/plplot-devel
