Skip to content

Commit

Permalink
CMake: Add -std=c++11 to build (#300)
Browse files Browse the repository at this point in the history
* CI: Add -std=c++11 to macos build

Trying to fix macos build broken by
#240

* CMakeLists.txt: Add -std=c++11 to build
  • Loading branch information
andy5995 authored Feb 3, 2025
1 parent b268182 commit e3d03d0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ ENDIF()

PROJECT( MegaGlest )

# This helps prevent certain errors such as what's mentioned in
# https://github.com/MegaGlest/megaglest-source/pull/300
# and also some consider it good practice to specify a standard
#
# https://cmake.org/cmake/help/v3.7/prop_tgt/CXX_STANDARD.html?highlight=cxx_standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)

#SET(CMAKE_VERBOSE_MAKEFILE ON)

#
Expand Down
4 changes: 0 additions & 4 deletions mk/macos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
# Seems like a good place to add version specific compiler flags too.

IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ENDIF()

Expand Down
10 changes: 0 additions & 10 deletions source/g3d_viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ SET(TARGET_NAME_MANPAGE "${TARGET_NAME}.6")
IF(BUILD_MEGAGLEST_MODEL_VIEWER)
MESSAGE(STATUS "Will try to build MegaGlest model viewer")

IF(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
IF("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.7 OR NOT "${CMAKE_CXX_COMPILER_VERSION}")
ADD_DEFINITIONS("-std=gnu++0x")
ELSEIF("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 5.1)
ADD_DEFINITIONS("-std=c++11")
ENDIF()

# Was required at least on bsd and macos.
ENDIF()

IF(NOT VCPKG_TARGET_TRIPLET)
FIND_PACKAGE(${SDL_VERSION_NAME} REQUIRED)
ELSE()
Expand Down
10 changes: 0 additions & 10 deletions source/glest_map_editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ SET(TARGET_NAME_MANPAGE "${TARGET_NAME}.6")
IF(BUILD_MEGAGLEST_MAP_EDITOR)
MESSAGE(STATUS "Will try to build MegaGlest map editor")

IF(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
IF("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.7 OR NOT "${CMAKE_CXX_COMPILER_VERSION}")
ADD_DEFINITIONS("-std=gnu++0x")
ELSEIF("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 5.1)
ADD_DEFINITIONS("-std=c++11")
ENDIF()

# Was required at least on bsd and macos.
ENDIF()

IF(NOT VCPKG_TARGET_TRIPLET)
FIND_PACKAGE(${SDL_VERSION_NAME} REQUIRED)
ELSE()
Expand Down

0 comments on commit e3d03d0

Please sign in to comment.