Skip to content

FindThreads: avoid failing in AIX when using -D_XOPEN_SOURCE=500

Carlo Arenas requested to merge carenas/cmake:aixthread2 into master

A rebased solution to the proposed code from !7131 (closed) on top of recent improvements to the FindThreads module.

Tested on AIX 7.1, not to introduce any regressions and allow for the following (or its C equivalent) to work both with GNU and XL compilers (with and without THREADS_PREFER_PTHREAD_FLAG)

cmake_minimum_required(VERSION 3.22.0)
project(test CXX)
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=500")
set(THREADS_PREFER_PTHREAD_FLAG true)
find_package(Threads REQUIRED)
message("DEBUG: INIT = ${CMAKE_THREAD_LIBS_INIT}")

Topic-rename: FindThreads-aix

Edited by Carlo Arenas

Merge request reports