mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:05:39 +08:00
cmake: force C++11 in CHECK_CXX_SOURCE_COMPILES for atomic
GCC 4.8 requires the use of `-std=gnu++11` or similar to enable atomic features. However, older versions of CMake don't pick up the project-wide target for C++11 when building the configure check targets. Although CMake policy 0067 could be set to NEW to enable this, it only exists on CMake 3.8 and newer, while many of our supported platforms are on an older version.
This commit is contained in:
parent
6dd9e50f82
commit
45633f4a54
|
@ -189,6 +189,13 @@ int main () {
|
|||
FIND_PROGRAM(SED sed)
|
||||
|
||||
# https://github.com/fish-shell/fish-shell/issues/5865
|
||||
CMAKE_PUSH_CHECK_STATE()
|
||||
# Needed until CMP0067 is set to NEW
|
||||
# g++ 4.8 needs -std=gnu+11 set to enable atomic features, but CMake < 3.8 does not add that
|
||||
# flag to TRY_COMPILE targets even when set for the project
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
LIST(APPEND CMAKE_REQUIRED_FLAGS "-std=gnu++11")
|
||||
ENDIF()
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
@ -200,3 +207,4 @@ LIBATOMIC_NOT_NEEDED)
|
|||
IF (NOT LIBATOMIC_NOT_NEEDED)
|
||||
SET(ATOMIC_LIBRARY "atomic")
|
||||
ENDIF()
|
||||
CMAKE_POP_CHECK_STATE()
|
||||
|
|
Loading…
Reference in New Issue
Block a user