diff options
author | Brad King <brad.king@kitware.com> | 2015-09-25 14:12:37 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-25 14:12:37 (GMT) |
commit | 910ea2100425289ec4f13327141b5c45ede320bd (patch) | |
tree | e4f0baf8c87443cf77e882bee7b6c3f9c670d76b /Tests | |
parent | ede54544f1cbaa623628317887ffc34fce4bc89b (diff) | |
parent | fff9434d455600320be1809c6d64577eeb21d6aa (diff) | |
download | CMake-910ea2100425289ec4f13327141b5c45ede320bd.zip CMake-910ea2100425289ec4f13327141b5c45ede320bd.tar.gz CMake-910ea2100425289ec4f13327141b5c45ede320bd.tar.bz2 |
Merge topic 'Threads-CXX'
fff9434d FindThreads: officially announce it works with only C++ enabled
66db914a FindThreads: fix printing a pointer value in test code
0b38424c FindThreads: make the call to try_run() work also if only C++ is enabled
9924a212 FindThreads: replace CheckIncludeFiles by CheckIncludeFile
a27bc0cc Check(Function|Library|Symbol)Exists: make it work if only C++ is enabled
7279f293 FindThreads: add simple testcase
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/FindThreads/C-only/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindThreads/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/FindThreads/CXX-only/CMakeLists.txt | 13 |
4 files changed, 36 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index fff04ce..dc65a2e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1365,6 +1365,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindOpenSSL) endif() + add_subdirectory(FindThreads) + # Matlab module if(CMake_TEST_FindMatlab) ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>) diff --git a/Tests/FindThreads/C-only/CMakeLists.txt b/Tests/FindThreads/C-only/CMakeLists.txt new file mode 100644 index 0000000..ab4ca0d --- /dev/null +++ b/Tests/FindThreads/C-only/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +project(FindThreads_C-only C) + +set(CMAKE_THREAD_PREFER_PTHREAD On) +find_package(Threads REQUIRED) + +if (NOT WIN32) + add_executable(thr ${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c) + target_link_libraries(thr Threads::Threads) +endif () diff --git a/Tests/FindThreads/CMakeLists.txt b/Tests/FindThreads/CMakeLists.txt new file mode 100644 index 0000000..aa9499b --- /dev/null +++ b/Tests/FindThreads/CMakeLists.txt @@ -0,0 +1,11 @@ +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 () diff --git a/Tests/FindThreads/CXX-only/CMakeLists.txt b/Tests/FindThreads/CXX-only/CMakeLists.txt new file mode 100644 index 0000000..9993123 --- /dev/null +++ b/Tests/FindThreads/CXX-only/CMakeLists.txt @@ -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 () |