File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,6 +229,8 @@ INCLUDE(CheckLibraryExists)
229229INCLUDE (CheckIncludeFile )
230230INCLUDE (CheckFunctionExists )
231231INCLUDE (CheckTypeSize )
232+ INCLUDE (CMakePushCheckState )
233+ INCLUDE (CheckCXXSourceRuns )
232234INCLUDE (${SCL_CMAKE_DIR} /FindLEX.cmake )
233235INCLUDE (${SCL_CMAKE_DIR} /FindYACC.cmake )
234236
@@ -250,6 +252,26 @@ CHECK_FUNCTION_EXISTS(getopt HAVE_GETOPT)
250252
251253CHECK_TYPE_SIZE ("ssize_t" SSIZE_T )
252254
255+ set ( TEST_STD_THREAD "
256+ #include <iostream>
257+ #include <thread>
258+ void do_work() {
259+ std::cout << \" thread\" << std::endl;
260+ }
261+ int main() {
262+ std::thread t(do_work);
263+ t.join();
264+ }
265+ " )
266+ cmake_push_check_state ()
267+ if ( UNIX )
268+ set ( CMAKE_REQUIRED_FLAGS "-pthread -std=c++0x" )
269+ else ( UNIX )
270+ # vars probably need set for MSVC11, embarcadero, etc
271+ endif ( UNIX )
272+ CHECK_CXX_SOURCE_RUNS ( "${TEST_STD_THREAD} " HAVE_STD_THREAD ) #quotes are *required*!
273+ cmake_pop_check_state ()
274+
253275# Now that all the tests are done, configure the scl_cf.h file:
254276get_property (CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SCL_CONFIG_H_CONTENTS )
255277file (WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS} " )
Original file line number Diff line number Diff line change 2020
2121#cmakedefine HAVE_SSIZE_T 1
2222
23+ #cmakedefine HAVE_STD_THREAD 1
24+
2325#endif /* SCL_CF_H */
You can’t perform that action at this time.
0 commit comments