From: Mattia Basaglia Date: Sun, 26 Jul 2015 10:02:54 +0000 (+0200) Subject: Make it compile again X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6112a0ce96a78ee1d73ad947418d640618425e80;p=xonotic%2Fnetradiant.git Make it compile again --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 23fabf54..cd42e5b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,18 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR) project(NetRadiant C CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# For some reason the above flags don't really work... +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX) + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(--std=c++${CMAKE_CXX_STANDARD} STD_CXX) + if(STD_CXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++${CMAKE_CXX_STANDARD}") + else() + message(SEND_ERROR "Requires C++${CMAKE_CXX_STANDARD} or better") + endif() +else() + message(WARNING "Unrecognized compiler: ${CMAKE_CXX_COMPILER_ID}, make sure it supports C++${CMAKE_CXX_STANDARD}") +endif() set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) @@ -524,10 +536,7 @@ add_library(stream add_library(string libs/string/pooledstring.cpp libs/string/pooledstring.h - libs/string/string.cpp libs/string/string.h - libs/string/stringfwd.cpp - libs/string/stringfwd.h ) add_library(xml diff --git a/libs/container/hashtable.cpp b/libs/container/hashtable.cpp index 046267ac..372295bb 100644 --- a/libs/container/hashtable.cpp +++ b/libs/container/hashtable.cpp @@ -32,11 +32,11 @@ void testStuff(){ typedef HashTable MyHashTable; MyHashTable hashtable; hashtable["bleh"] = 5; - hashtable.insert( "blah", 17 ); + hashtable.insert({"blah", 17}); hashtable["foo"] = 99; - hashtable.insert( "bar", 23 ); + hashtable.insert({"bar", 23}); - int bleh = ( *hashtable.find( "bleh" ) ).value; // 5 + int bleh = ( *hashtable.find( "bleh" ) ).second; // 5 int blah = hashtable["blah"]; // 17 hashtable.erase( "foo" ); MyHashTable::iterator barIter = hashtable.find( "bar" ); diff --git a/libs/container/hashtable.h b/libs/container/hashtable.h index 6b16bd60..cb27eace 100644 --- a/libs/container/hashtable.h +++ b/libs/container/hashtable.h @@ -23,6 +23,7 @@ #define INCLUDED_CONTAINER_HASHTABLE_H #include +#include "debugging/debugging.h" template > using HashTable = std::unordered_map;