I am linking against an external library in a C++ GCC project, on Ubuntu, compiled with cmake (The Blender Cycles renderer library): http://ift.tt/2kqkINs
My local code requires C++11, so I set -std=c++11. But this causes a ton of nasty runtime crashes, as the library I am linking against doesn't have this set and has this code that makes it binary incompatible, if the __cplusplus versions difer (std::mutex and boost::mutex are different sizes):
#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
typedef std::mutex thread_mutex;
typedef std::unique_lock<std::mutex> thread_scoped_lock;
typedef std::condition_variable thread_condition_variable;
#else
/* use boost for mutexes */
typedef boost::mutex thread_mutex;
typedef boost::mutex::scoped_lock thread_scoped_lock;
typedef boost::condition_variable thread_condition_variable;
#endif
Everything is fine if I go into the Cycles library's Cmake file and add the C++11 flag manually, but that seems hacky. Is there anyway to force GCC to use a later compiler version from the command line, or GCC environment, when I rebuild the external library, without changing the external makefile?
Aucun commentaire:
Enregistrer un commentaire