FindThreads: officially announce it works with only C++ enabled

This commit is contained in:
Rolf Eike Beer 2015-09-22 17:50:59 +02:00 committed by Brad King
parent 66db914adf
commit fff9434d45
3 changed files with 27 additions and 12 deletions

View File

@ -1,6 +1,6 @@
Threads-CXX
------------
* The :module:`CheckFunctionExists`, :module:`CheckLibraryExists`, and
:module:`CheckSymbolExists` modules learned to work in environments where
only CXX is enabled.
* The :module:`CheckFunctionExists`, :module:`CheckLibraryExists`,
:module:`CheckSymbolExists`, and :module:`FindThreads` modules learned to
work in environments where only CXX is enabled.

View File

@ -1,9 +1,11 @@
add_test(NAME FindThreads.C-only COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindThreads/C-only"
"${CMake_BINARY_DIR}/Tests/FindThreads/C-only"
${build_generator_args}
--build-project FindThreads_C-only
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V
)
foreach (_lang IN ITEMS C CXX)
add_test(NAME FindThreads.${_lang}-only COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindThreads/${_lang}-only"
"${CMake_BINARY_DIR}/Tests/FindThreads/${_lang}-only"
${build_generator_args}
--build-project FindThreads_${_lang}-only
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V
)
endforeach ()

View File

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(FindThreads_CXX-only CXX)
set(CMAKE_THREAD_PREFER_PTHREAD On)
find_package(Threads REQUIRED)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c
${CMAKE_CURRENT_BINARY_DIR}/CheckForPthreads.cxx)
if (NOT WIN32)
add_executable(thr ${CMAKE_CURRENT_BINARY_DIR}/CheckForPthreads.cxx)
target_link_libraries(thr Threads::Threads)
endif ()