diff --git a/CMakeLists.txt b/CMakeLists.txt index 521f663..2f1cfb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,15 @@ project(easy_profiler CXX) set_property(GLOBAL PROPERTY USE_FOLDERS ON) +if (CMAKE_VERSION VERSION_LESS "3.1") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + endif () +else () + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +endif () + option(EASY_PROFILER_NO_GUI "Build easy_profiler without the GUI application (required Qt)" OFF) set(EASY_PROGRAM_VERSION_MAJOR 2) diff --git a/easy_profiler_core/CMakeLists.txt b/easy_profiler_core/CMakeLists.txt index b8b6f34..65ddceb 100644 --- a/easy_profiler_core/CMakeLists.txt +++ b/easy_profiler_core/CMakeLists.txt @@ -20,9 +20,9 @@ if (NOT WIN32) set(NO_CXX11_THREAD_LOCAL_SUPPORT TRUE) endif () endif () - + # TODO: Check thread_local keyword support for other compilers for Unix - + if (NO_CXX11_THREAD_LOCAL_SUPPORT) message(WARNING " Your compiler does not support C++11 thread_local feature.") message(WARNING " Without C++11 thread_local feature you may face to possible memory leak or application crash if using implicit thread registration and using EASY_THREAD instead of EASY_THREAD_SCOPE.") @@ -233,20 +233,6 @@ if (MSVC) target_compile_options(easy_profiler PRIVATE /WX) endif () -if (APPLE) - target_compile_options(easy_profiler PUBLIC -std=gnu++11) -else () - if (CMAKE_VERSION VERSION_LESS "3.1") - if (NOT MSVC) - target_compile_options(easy_profiler PUBLIC $<$:-std=gnu++11>) - endif () - else () - if (NOT MSVC) - target_compile_options(easy_profiler PUBLIC -std=gnu++11) - endif () - set_target_properties(easy_profiler PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) - endif () -endif () # End adding platform specific compile options. ###############################################################################