Compiling a cmake project using the COMPILE_FEATURES property (eg c++11) on the macos image (clang 4.0.1) leads to this kind of error:
2019-05-12T09:10:30.9991860Z -- The C compiler identification is Clang 4.0.1
2019-05-12T09:10:31.1369530Z -- The CXX compiler identification is Clang 4.0.1
2019-05-12T09:10:31.1582240Z -- Check for working C compiler: $BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang
2019-05-12T09:10:31.3665200Z -- Check for working C compiler: $BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang -- works
2019-05-12T09:10:31.3689410Z -- Detecting C compiler ABI info
2019-05-12T09:10:31.5698720Z -- Detecting C compiler ABI info - done
2019-05-12T09:10:31.5875630Z -- Detecting C compile features
2019-05-12T09:10:31.5886940Z -- Detecting C compile features - done
2019-05-12T09:10:31.6007210Z -- Check for working CXX compiler: $BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++
2019-05-12T09:10:31.8092780Z -- Check for working CXX compiler: $BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++ -- works
2019-05-12T09:10:31.8114730Z -- Detecting CXX compiler ABI info
2019-05-12T09:10:32.0164260Z -- Detecting CXX compiler ABI info - done
2019-05-12T09:10:32.0377210Z -- Detecting CXX compile features
2019-05-12T09:10:32.0384370Z -- Detecting CXX compile features - done
2019-05-12T09:10:32.0415860Z CMake Error at CMakeLists.txt:10 (target_compile_features):
2019-05-12T09:10:32.0416280Z target_compile_features no known features for CXX compiler
2019-05-12T09:10:32.0416680Z
2019-05-12T09:10:32.0417160Z "Clang"
2019-05-12T09:10:32.0417580Z
2019-05-12T09:10:32.0417810Z version 4.0.1.
2019-05-12T09:10:32.0418060Z
2019-05-12T09:10:32.0418220Z
2019-05-12T09:10:32.0438540Z -- Configuring incomplete, errors occurred!
Here's the minimal non-working example:
https://github.com/jschueller/cmake-target_compile_features
Similar reports:
is it specific to conda-forge ?
It's not specific to conda-forge. CMake has issues with vanilla clang on MacOSX. Try changing the cmake_minimum_required line to 3.
Oh you're right, setting 3.0 does make the build succeed. Do you know why @isuruf ?
target_compile_features is only available for cmake >=3.0. Requiring that the code be compatible with 2.8 messes up Clang compiler detection. You could also set CMP0025 to new before cmake_minimum_required line and it might work as well.
It should be :
cmake_minimum_required (VERSION 2.8.12)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
project (hello)
I ran in to this error with CMake 3.15, and -- to avoid patching source -- a different work-around is to tell CMake that the compiler has the requested feature(s):
-DCMAKE_CXX_COMPILE_FEATURES=cxx_constexpr
(it's not clear to me if or why CMP0025 was disabled in my case, because CMake version was 3.15, and the package had set cmake_minimum_required(VERSION 3.1). CMake knows about upstream Clang versioning for other platforms, but perhaps on APPLE some logic is shunted toward AppleClang)