Merged
Merge Request #1 · created by Peter M. Groen


Feat/pgroen/detect cpp standard

Om de hoogst mogelijke C++ standaard mogelijk te detecteren, wordt de compiler afgevraagd wat er wordt ondersteund. Deze standaard wordt dan gevolgd. In de toekomst moet dit gedrag aan / uit gezet kunnen worden met een switch waarin een standaard hard kan worden gezet.


From feat/pgroen/detect-cpp-standard into master

Merged by Peter M. Groen

Source branch has been removed
2 participants
    Steven de Ridder started a discussion on the diff
    last updated by Peter M. Groen
    compiler.cmake
      134 + CHECK_CXX_COMPILER_FLAG( -std=c++14 cxxresult )
      135 + if( NOT cxxresult )
      136 + CHECK_CXX_COMPILER_FLAG( -std=c++11 cxxresult )
      137 + if( NOT cxxresult )
      138 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
      139 + else()
      140 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
      141 + endif()
      142 + else()
      143 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
      144 + endif()
      145 + else()
      146 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
    135 147 endif()
    136   - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
      148 + MESSAGE(STATUS "Compiling for ${CMAKE_CXX_FLAGS}")
    2
    • Steven de Ridder @sridder

      This message prints all cxx flags, not just the c++ version.

      Compiling for -Wall -Wextra -pedantic -Wshadow -Wnon-virtual-dtor -Woverloaded-virtual -Winit-self -Wuninitialized -Wunused -Wcast-qual -Wno-long-long -Wold-style-cast -Werror=return-type -Wno-noexcept-type -Werror -fPIC -fstack-protector-all -fthreadsafe-statics -mfpmath=sse -std=c++17

      Do we want this behavior or should we limit the message to only show the c++ version in use?

      Edit in fullscreen
      Comments are parsed with GitLab Flavored Markdown
      Attach files by dragging & dropping or selecting them.
    • Peter M. Groen @pgroen

      I really would like have the whole flag status printed for debugging purposes.

      Edit in fullscreen
      Comments are parsed with GitLab Flavored Markdown
      Attach files by dragging & dropping or selecting them.
    Steven de Ridder started a discussion on the diff
    last updated by Peter M. Groen
    compiler.cmake
    127 127 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse" )
    128 128 endif()
    129 129  
    130   - # -std=c++11 will be supported starting GCC 4.7, older versions need c++0x
    131   - CHECK_CXX_COMPILER_FLAG( -std=c++11 cxxresult )
    132   -
    133   - if( NOT cxxresult)
    134   - message(FATAL_ERROR, "Compiler does not support c++11")
      130 + MESSAGE(STATUS "Checking the c++ Standard supported by the compiler" )
      131 + # Check which version of c++ we can use. We drill down from c++17 to c96
    2
  • Steven de Ridder @sridder

    Reassigned to @pgroen

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach files by dragging & dropping or selecting them.
  • Peter M. Groen @pgroen
    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach files by dragging & dropping or selecting them.
  • Peter M. Groen @pgroen

    Status changed to merged

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach files by dragging & dropping or selecting them.

compiler.cmake
@@ -127,13 +127,25 @@ if(CMAKE_COMPILER_IS_GNUCXX) @@ -127,13 +127,25 @@ if(CMAKE_COMPILER_IS_GNUCXX)
127 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse" ) 127 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse" )
128 endif() 128 endif()
129 129
130 - # -std=c++11 will be supported starting GCC 4.7, older versions need c++0x  
131 - CHECK_CXX_COMPILER_FLAG( -std=c++11 cxxresult )  
132 -  
133 - if( NOT cxxresult)  
134 - message(FATAL_ERROR, "Compiler does not support c++11") 130 + MESSAGE(STATUS "Checking the c++ Standard supported by the compiler" )
  131 + # Check which version of c++ we can use. We drill down from c++17 to c96
2
  132 + CHECK_CXX_COMPILER_FLAG( -std=c++17 cxxresult )
  133 + if( NOT cxxresult )
  134 + CHECK_CXX_COMPILER_FLAG( -std=c++14 cxxresult )
  135 + if( NOT cxxresult )
  136 + CHECK_CXX_COMPILER_FLAG( -std=c++11 cxxresult )
  137 + if( NOT cxxresult )
  138 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  139 + else()
  140 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  141 + endif()
  142 + else()
  143 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
  144 + endif()
  145 + else()
  146 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
135 endif() 147 endif()
136 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 148 + MESSAGE(STATUS "Compiling for ${CMAKE_CXX_FLAGS}")
2
  • Steven de Ridder @sridder

    This message prints all cxx flags, not just the c++ version.

    Compiling for -Wall -Wextra -pedantic -Wshadow -Wnon-virtual-dtor -Woverloaded-virtual -Winit-self -Wuninitialized -Wunused -Wcast-qual -Wno-long-long -Wold-style-cast -Werror=return-type -Wno-noexcept-type -Werror -fPIC -fstack-protector-all -fthreadsafe-statics -mfpmath=sse -std=c++17

    Do we want this behavior or should we limit the message to only show the c++ version in use?

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach files by dragging & dropping or selecting them.
  • Peter M. Groen @pgroen

    I really would like have the whole flag status printed for debugging purposes.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach files by dragging & dropping or selecting them.
137 149
138 # -Wzero-as-null-pointer-constant is disabled for now, since the Qt 4.8.4 150 # -Wzero-as-null-pointer-constant is disabled for now, since the Qt 4.8.4
139 # macro's produce a bucketload of these warnings. Might be useful later on. 151 # macro's produce a bucketload of these warnings. Might be useful later on.