Closed spoutn1k closed 2 years ago
Hi @spoutn1k
Many thanks for your feedback.
I am not able to reproduce (cmake 3.9.1, 3.20.3, 3.22.2), but I agree that Threads_FOUND
does the job for cmake-3.17+.
Can you tell me if something like that works for you, please?
find_package(Threads)
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
if(NOT CMAKE_THREAD_LIBS_INIT)
message(FATAL_ERROR "Be sure to have Pthread available on you system")
endif()
else()
if(NOT Threads_FOUND)
message(FATAL_ERROR "Be sure to have Pthread available on you system")
endif()
endif()
Best, Adrien
Interesting. I tested on some more machines in the lab using ubuntu containers, and some fail while some do not. It seemed like more recent versions of glib tended to fail.
The patch works ! Thanks for the quick response !
Great, I gonna add it to my current PR. You're welcome :smiley: :+1:!
Hey there,
I have been encountering an issue configuring the project, the following error preventing success:
I deleted the following check: https://github.com/cea-hpc/wi4mpi/blob/17e2911921541653a8d501966d185fecebdf1949/CMakeLists.txt#L127-L130
And configuration, compilation and execution worked. Looking at the CMake documentation, this value
CMAKE_THREAD_LIBS_INIT
underwent some change in the nearish past.CMake 3.16.9:
CMake 3.17.5:
Maybe I am missing something on my systems. This happened with CMake 3.23 and CMake 3.17 on a test machine and on a OLCF machine. I would tend to think that replacing
CMAKE_THREAD_LIBS_INIT
withThreads::Threads
import target available on both versions would do the trick.EDIT: It would appear
Threads_FOUND
can be true withThreads::Threads
andCMAKE_THREAD_LIBS_INIT
both empty. Backwards compatibility may be doable with a version check.