zjx20 / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Need pthreads detection suppression in CMake build script #269

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some OSes support POSIX threads but gtest's threading tests fail there. See 
http://groups.google.com/group/googletestframework/browse_thread/thread/66eacb6c
45df8470/
8fc028eeee080d29#8fc028eeee080d29 for an example.

autoconf build script has the --with_threads=no flag to suppress use of 
threads. We need a similar 
functionality in CMake build script to support such systems.

Original issue reported on code.google.com by vladlosev on 27 Mar 2010 at 10:32

GoogleCodeExporter commented 9 years ago
Another example: MinGW with GCC 4.4 (see issue 298).

Original comment by vladlosev on 7 Jul 2010 at 6:08

GoogleCodeExporter commented 9 years ago
Instead of complicating the cmake script, I'd prefer to hard code the disabling 
of threading in gtest-port.h for such obscure platforms.

Original comment by w...@google.com on 27 Sep 2010 at 7:18

GoogleCodeExporter commented 9 years ago
The way to control the compiler settings in a CMake setup is through the CMake 
script. How else do you plan to pass them to the compiler when using CMake?

And the changes to the script do not have to be too big. All you have to do is 
to add an option and condition the detection invocation based on that option. 
It will take a total of 4 lines of code; more with comments.

Original comment by vladlosev on 27 Sep 2010 at 10:48

GoogleCodeExporter commented 9 years ago
I wouldn't think MinGW with pthreads is a terribly obscure platform; TDM-GCC 
<http://tdm-gcc.tdragon.net/> installs pthreads by default even (you can't use 
GCC's OpenMP support without it).

Original comment by ian.cull...@uqconnect.edu.au on 27 Sep 2010 at 10:56

GoogleCodeExporter commented 9 years ago
As said, I'd prefer to *hard-code* the disabling of pthreads in gtest-port.h, 
like we did for many other capabilities.

People want gtest to work out-of-the-box.  Hard-coding the logic in 
gtest-port.h means that most users don't have to specify any cmake flags.  
Every option we add to the cmake script increases the cognitive burden on the 
users.

It may be that eventually we'll have to add a flag -- I don't know yet.  But 
before that day comes, I'd like to keep it simple.

Original comment by w...@google.com on 28 Sep 2010 at 12:08

GoogleCodeExporter commented 9 years ago
@cibyr, I was saying that we should make gtest work out-of-the-box on MinGW, 
instead of requiring the user to specify any build option.  The "won't fix" 
refers to "need pthreads detection suppression in cmake build script".  I'll 
revive 298 to track the fix for mingw, etc.

Original comment by w...@google.com on 28 Sep 2010 at 12:11