mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
CMake: Add workaround for setting -std=
below 3.1.3
Previously, if the user had a CMake version below 3.1.3, we told them to set `-std` themselves. However, we are going to go to C99 soon (because of FAudio, see #869), and CentOS 7's CMake is too old to set `-std=` automatically, defaulting to C90. This is bad because it fails the CI. To work around this, we set `-std=` ourselves, but first we have to clear any existing `-std=` flag in C_FLAGS or CXX_FLAGS. Amusingly enough, MSVC does not have `/std:` switches for either C90 or C++98, so we just get to do nothing.
This commit is contained in:
parent
226b5610b0
commit
f6d7a214f8
1 changed files with 11 additions and 1 deletions
|
@ -25,7 +25,17 @@ if(OFFICIAL_BUILD AND NOT MAKEANDPLAY)
|
|||
endif()
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.1.3")
|
||||
message(WARNING "Your CMake version is too old; set -std=c90 -std=c++98 yourself!")
|
||||
message(WARNING "Your CMake version is too old; using workaround")
|
||||
|
||||
if(MSVC)
|
||||
# MSVC doesn't have /std:c90 or /std:c++98 switches!
|
||||
else()
|
||||
string(REGEX REPLACE "-std=[a-z0-9]+" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c90")
|
||||
|
||||
string(REGEX REPLACE "-std=[a-z0-9+]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_C_STANDARD 90)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
|
|
Loading…
Reference in a new issue