0

I'm trying to understand why the libmysql CMake project configured with /MD and /MDd flags does not generate the appropriate Visual Studio 10 project files. The appropriate CMAKE_ macros have been configured, as shown:

macros

Yet the generated projects are still showing unexpected Runtime Library settings:

enter image description here

Is the CMake GUI for some reason unreliable, or is it possible that another option is overriding the CRT settings?

jwalk
  • 1,120
  • 11
  • 27
  • Do all of your dependencies (like libmysql since its tagged) use /MTd? – drescherjm Apr 25 '13 at 12:42
  • @drescherjm please note that libmysql *is* the project I'm attempting to generate using cmake. I've also updated question with further investigations. – jwalk Apr 25 '13 at 12:49
  • 1
    The GUI does not pick up on these because the GUI only reads and writes the values to and from the cache not the result of the generate. – drescherjm Apr 25 '13 at 14:03
  • 1
    It's very misleading, though. The values displayed are not ever used when generating the project files. A user's changes would never take effect. Why not just `FORCE` these flags so that at least the user is aware of the actual values being used to generate the project files? – jwalk Apr 25 '13 at 15:26
  • 2
    @jwalk That is a very good question, but one for the authors of `libmysql` CMake support. – Angew is no longer proud of SO Apr 26 '13 at 09:32

1 Answers1

2

I found that the cmake project for libmysql has an OS-specific cmake file for Windows which forces static runtimes to be used when generating the Visual Studio solution:

 75   # Force static runtime libraries
 83   FOREACH(flag
 84    CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
 85    CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
 86    CMAKE_CXX_FLAGS_RELEASE  CMAKE_CXX_FLAGS_RELWITHDEBINFO
 87    CMAKE_CXX_FLAGS_DEBUG  CMAKE_CXX_FLAGS_DEBUG_INIT)
 88    STRING(REPLACE "/MD"  "/MT" "${flag}" "${${flag}}")
 89    SET("${flag}" "${${flag}} /EHsc")
 98   ENDFOREACH()
jwalk
  • 1,120
  • 11
  • 27