Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-04-09 15:16:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-09 15:16:37 +0400
commit5457c871ef71f69e9a17b9dcb462becf86c41577 (patch)
tree618eb6c9b1b6bfb266c6c8a30e1be7f0db2f5c5a /CMakeLists.txt
parentd13df6cffc19068edf6ce8667193de578872efdf (diff)
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef8b8efc772..b0da2360b84 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,8 +50,33 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules/")
# 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()
#-----------------------------------------------------------------------------