AIX: Add -pthread flag to enable std::thread with GCC
This commit is contained in:
parent
6e613ff399
commit
4ff89fb608
@ -2,7 +2,11 @@
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake)
|
||||
project(CMake)
|
||||
unset(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
|
||||
unset(CMAKE_USER_MAKE_RULES_OVERRIDE_C)
|
||||
|
||||
# Make sure we can find internal find_package modules only used for
|
||||
# building CMake and not for shipping externally
|
||||
|
3
Source/Modules/OverrideC.cmake
Normal file
3
Source/Modules/OverrideC.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
if("${CMAKE_SYSTEM_NAME};${CMAKE_C_COMPILER_ID}" STREQUAL "AIX;GNU")
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -pthread")
|
||||
endif()
|
3
Source/Modules/OverrideCXX.cmake
Normal file
3
Source/Modules/OverrideCXX.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
if("${CMAKE_SYSTEM_NAME};${CMAKE_CXX_COMPILER_ID}" STREQUAL "AIX;GNU")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -pthread")
|
||||
endif()
|
13
bootstrap
13
bootstrap
@ -982,6 +982,9 @@ if [ -z "${CC}" -a -z "${CXX}" ]; then
|
||||
fi
|
||||
|
||||
thread_flags=''
|
||||
case "${cmake_system}" in
|
||||
*AIX*) thread_flags='-pthread' ;;
|
||||
esac
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Test C compiler
|
||||
@ -1003,6 +1006,10 @@ echo '
|
||||
# error "The CMAKE_C_COMPILER is set to a C++ compiler"
|
||||
#endif
|
||||
|
||||
#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
|
||||
#error "On AIX with GNU we need the -pthread flag."
|
||||
#endif
|
||||
|
||||
#if defined(__sun) && __STDC_VERSION__ < 199901L
|
||||
#error "On Solaris we need C99."
|
||||
#endif
|
||||
@ -1066,6 +1073,10 @@ echo '
|
||||
#error "Compiler is not in a mode aware of C++11."
|
||||
#endif
|
||||
|
||||
#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
|
||||
#error "On AIX with GNU we need the -pthread flag."
|
||||
#endif
|
||||
|
||||
#if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
|
||||
#error "SunPro <= 5.13 mode not supported due to bug in move semantics."
|
||||
#endif
|
||||
@ -1326,7 +1337,7 @@ else
|
||||
uv_c_flags="${uv_c_flags} -DCMAKE_BOOTSTRAP"
|
||||
case "${cmake_system}" in
|
||||
*AIX*)
|
||||
uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT -D_THREAD_SAFE"
|
||||
uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT"
|
||||
libs="${libs} -lperfstat"
|
||||
;;
|
||||
*Darwin*)
|
||||
|
Loading…
Reference in New Issue
Block a user