xtensor-stack / xtensor-blas

BLAS extension to xtensor
BSD 3-Clause "New" or "Revised" License
155 stars 54 forks source link

FindThreads cmake "error" in xtensor/test #203

Open billpriest opened 3 years ago

billpriest commented 3 years ago

In building the tests for xtensor I saw the following: xtensor/test > cmake . CMake Error at /usr/share/cmake-3.20/Modules/FindThreads.cmake:66 (message): FindThreads only works if either C or CXX language is enabled Call Stack (most recent call first): CMakeLists.txt:13 (find_package)

The following "hack" fixed the issue diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6e5cc7b9..2b64ed5a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,9 +9,6 @@

cmake_minimum_required(VERSION 3.1)

-find_package(doctest REQUIRED) -find_package(Threads)

if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) project(xtensor-test)

@@ -28,6 +25,9 @@ else() message(STATUS "Tests build type is ${CMAKE_BUILD_TYPE}") endif()

+find_package(doctest REQUIRED) +find_package(Threads) + include(CheckCXXCompilerFlag)

string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)

I'm also seeing issues when building wrt TEST_CASE_TEMPLATE (although I expect this is just having the wrong version of the test library; it would be nice if the CMakeLists.txt error'ed out unless the correct version is found).