[cmake-developers] [CMake 0015723]: Regression: FindCUDA fails for C++ only projects in CMake 3.3.1 due find_package(Threads), while it works well in CMake 3.2.3
Mantis Bug Tracker
mantis at public.kitware.com
Wed Sep 2 06:32:00 EDT 2015
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=15723
======================================================================
Reported By: Adam Strzelecki
Assigned To:
======================================================================
Project: CMake
Issue ID: 15723
Category: CMake
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2015-09-02 06:31 EDT
Last Modified: 2015-09-02 06:31 EDT
======================================================================
Summary: Regression: FindCUDA fails for C++ only projects in
CMake 3.3.1 due find_package(Threads), while it works well in CMake 3.2.3
Description:
CUDA language is C++ superset, so developers may prefer using C++ only project
together with CUDA. FindCUDA already supports such case (1) when neither
CUDA_HOST_COMPILER nor CMAKE_C_COMPILER is defined, just skips adding --ccbin.
Another case (2) is that user defined its own CUDA_HOST_COMPILER that is
different than CMAKE_C_COMPILER, then custom host compiler is passed to --ccbin.
The problem is that recently CUDA_USE_STATIC_CUDA_RUNTIME (default ON) started
calling find_package(Threads REQUIRED) that tries to lookup pthread using
CMAKE_C_COMPILER which is invalid in both cases (1) (2).
However I don't see any clear solution here. I understand that linking CUDA
static rt requires pthread linkage, but maybe we should just check if current
linker can either link -lpthread or -pthread, rather falling back to C compiler
that may be undefined for the project?
Steps to Reproduce:
# CMakeList.txt
cmake_minimum_required(VERSION 2.6)
project(OnlyCXXCUDA CXX)
find_package(CUDA)
$ cmake .
-- The CXX compiler identification is AppleClang 7.0.0.7000059
-- Check for working CXX compiler:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for include file pthread.h
CMake Error at
/Applications/CMake.app/Contents/share/cmake-3.3/Modules/CheckIncludeFiles.cmake:79
(try_compile):
Unknown extension ".c" for file
/Users/ono/Documents/Bugs/CMake/FindCUDA/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
try_compile() works only for enabled languages. Currently these are:
CXX
See project() command to enable other languages.
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.3/Modules/FindThreads.cmake:123
(CHECK_INCLUDE_FILES)
/Applications/CMake.app/Contents/share/cmake-3.3/Modules/FindCUDA.cmake:741
(find_package)
CMakeLists.txt:3 (find_package)
-- Looking for include file pthread.h - not found
CMake Error at
/Applications/CMake.app/Contents/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148
(message):
Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388
(_FPHSA_FAILURE_MESSAGE)
/Applications/CMake.app/Contents/share/cmake-3.3/Modules/FindThreads.cmake:204
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/Applications/CMake.app/Contents/share/cmake-3.3/Modules/FindCUDA.cmake:741
(find_package)
CMakeLists.txt:3 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/ono/Documents/Bugs/CMake/FindCUDA/CMakeFiles/CMakeOutput.log".
See also "/Users/ono/Documents/Bugs/CMake/FindCUDA/CMakeFiles/CMakeError.log".
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2015-09-02 06:31 Adam StrzeleckiNew Issue
======================================================================
More information about the cmake-developers
mailing list