Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindThreads cmake "error" in xtensor/test #203

Open
billpriest opened this issue Aug 24, 2021 · 0 comments
Open

FindThreads cmake "error" in xtensor/test #203

billpriest opened this issue Aug 24, 2021 · 0 comments

Comments

@billpriest
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant