[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36069] trunk/blender/CMakeLists.txt: change in how cmake works with CMAKE_C_STANDARD_LIBRARIES / CMAKE_CXX_STANDARD_LIBRARIES.
Campbell Barton
ideasman42 at gmail.com
Sat Apr 9 13:16:37 CEST 2011
Revision: 36069
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36069
Author: campbellbarton
Date: 2011-04-09 11:16:37 +0000 (Sat, 09 Apr 2011)
Log Message:
-----------
change in how cmake works with CMAKE_C_STANDARD_LIBRARIES / CMAKE_CXX_STANDARD_LIBRARIES.
if not defined (first run) these are now set blank but can be defined later.
the problem is that scons & cmake builds would link against different libraries since cmake added its own defaults.
now, by default, scons & cmake have the same libraries.
This fixes an obscure crash in MinGW where cmakes default linking with -ladvapi32 would crash on string formatting which used float precision as an argument, eg:
printf("%.*f", 3, value);
...without giving a useful backtrace or pointing to the line of code doing the string formatting.
Modified Paths:
--------------
trunk/blender/CMakeLists.txt
Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt 2011-04-09 02:23:39 UTC (rev 36068)
+++ trunk/blender/CMakeLists.txt 2011-04-09 11:16:37 UTC (rev 36069)
@@ -50,8 +50,33 @@
# quiet output for Makefiles, 'make -s' helps too
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
+# ignore system set flag, use our own
+# must be before project(...)
+# if the user wants to add their own its ok after first run.
+if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
+ set(_reset_standard_libraries OFF)
+else()
+ set(_reset_standard_libraries ON)
+endif()
+
+
project(Blender)
+
+if (_reset_standard_libraries)
+ message("Reset Libs")
+ # Must come after project(...)
+ #
+ # MINGW workaround for -ladvapi32 being included which surprisingly causes
+ # string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
+ # with a meaningless stack trace. by overriding this flag we ensure we only
+ # have libs we define and that cmake & scons builds match.
+ set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
+ set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
+endif()
+unset(_reset_standard_libraries)
+
+
enable_testing()
#-----------------------------------------------------------------------------
More information about the Bf-blender-cvs
mailing list