From kde-commits Sat May 03 07:12:57 2014 From: Shantanu Tushar Date: Sat, 03 May 2014 07:12:57 +0000 To: kde-commits Subject: [plasma-mediacenter] /: Enable C++11 Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=139910118605714 Git commit 29115a69f175aceac8804ea1a9be505d8c509fb5 by Shantanu Tushar. Committed on 03/05/2014 at 07:10. Pushed by shantanu into branch 'master'. Enable C++11 M +11 -0 CMakeLists.txt A +35 -0 libs/test/itemcachetest.cpp [License: LGPL (v2.1+)] A +31 -0 libs/test/itemcachetest.h [License: LGPL (v2.1+)] http://commits.kde.org/plasma-mediacenter/29115a69f175aceac8804ea1a9be505d8= c509fb5 diff --git a/CMakeLists.txt b/CMakeLists.txt index 71550fb..0f8138a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,17 @@ project(PlasmaMediaCenter) = option(NO_LINK_TO_PLASMA "Do not link to Plasma at compile-time" OFF) = +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=3Dc++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=3Dc++0x" COMPILER_SUPPORTS_CXX0X) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=3Dc++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=3Dc++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 su= pport. Please use a different C++ compiler.") +endif() + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) diff --git a/libs/test/itemcachetest.cpp b/libs/test/itemcachetest.cpp new file mode 100644 index 0000000..0dc4448 --- /dev/null +++ b/libs/test/itemcachetest.cpp @@ -0,0 +1,35 @@ +/*************************************************************************= ********** + * Copyright 2014 Shantanu Tushar = * + * = * + * = * + * This library is free software; you can redistribute it and/or = * + * modify it under the terms of the GNU Lesser General Public = * + * License as published by the Free Software Foundation; either = * + * version 2.1 of the License, or (at your option) any later version. = * + * = * + * This library is distributed in the hope that it will be useful, = * + * but WITHOUT ANY WARRANTY; without even the implied warranty of = * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU = * + * Lesser General Public License for more details. = * + * = * + * You should have received a copy of the GNU Lesser General Public = * + * License along with this library. If not, see . * + *************************************************************************= **********/ + +#include "itemcachetest.h" + +#include +#include + +#include + +QTEST_KDEMAIN(ItemCacheTest, NoGUI); + +void ItemCacheTest::shouldInsertAndReturnTheSameObjectNextTime() +{ + ItemCache artists; + + artists.getById("Shaan", true); +} + +#include "itemcachetest.moc" diff --git a/libs/test/itemcachetest.h b/libs/test/itemcachetest.h new file mode 100644 index 0000000..e5c8c45 --- /dev/null +++ b/libs/test/itemcachetest.h @@ -0,0 +1,31 @@ +/*************************************************************************= ********** + * Copyright 2014 Shantanu Tushar = * + * = * + * = * + * This library is free software; you can redistribute it and/or = * + * modify it under the terms of the GNU Lesser General Public = * + * License as published by the Free Software Foundation; either = * + * version 2.1 of the License, or (at your option) any later version. = * + * = * + * This library is distributed in the hope that it will be useful, = * + * but WITHOUT ANY WARRANTY; without even the implied warranty of = * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU = * + * Lesser General Public License for more details. = * + * = * + * You should have received a copy of the GNU Lesser General Public = * + * License along with this library. If not, see . * + *************************************************************************= **********/ + +#ifndef ITEMCACHETEST_H +#define ITEMCACHETEST_H + +#include + +class ItemCacheTest : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void shouldInsertAndReturnTheSameObjectNextTime(); +}; + +#endif // ITEMCACHETEST_H