target_compile_features no known features for Clang 5.0.1
On OSX 10.12 do the following:
brew install llvm # Currently 5.0.1
brew install cmake # Currently 3.10.2
mkdir ~/test
cd ~/test
cat <<EOF >CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
add_library(foo foo.cpp)
target_compile_features(foo PUBLIC cxx_constexpr)
EOF
echo "int foo() { return 1; }" > foo.cpp
mkdir build
cd build
export CC="$(brew --prefix llvm)/bin/clang"
export CXX="$(brew --prefix llvm)/bin/clang++"
export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
export CFLAGS="-I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11"
export CXXFLAGS="-I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11"
cmake ..
You get the following error:
CMake Error at CMakeLists.txt:3 (target_compile_features):
target_compile_features no known features for CXX compiler
"Clang"
version 5.0.1.
And this debug log output.
The system is: Darwin - 16.7.0 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/local/opt/llvm/bin/clang
Build flags: -I/usr/local/opt/llvm/include;--target=x86_64-apple-darwin16.0.0;-mmacosx-version-min=10.11
Id flags:
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
The C compiler identification is Clang, found in "/Users/timh/test/build/CMakeFiles/3.10.2/CompilerIdC/a.out"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/local/opt/llvm/bin/clang++
Build flags: -I/usr/local/opt/llvm/include;--target=x86_64-apple-darwin16.0.0;-mmacosx-version-min=10.11
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
The CXX compiler identification is Clang, found in "/Users/timh/test/build/CMakeFiles/3.10.2/CompilerIdCXX/a.out"
Determining if the C compiler works passed with the following output:
Change Dir: /Users/timh/test/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ce97b/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_ce97b.dir/build.make CMakeFiles/cmTC_ce97b.dir/build
Building C object CMakeFiles/cmTC_ce97b.dir/testCCompiler.c.o
/usr/local/opt/llvm/bin/clang -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -o CMakeFiles/cmTC_ce97b.dir/testCCompiler.c.o -c /Users/timh/test/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_ce97b
/usr/local/Cellar/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ce97b.dir/link.txt --verbose=1
/usr/local/opt/llvm/bin/clang -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib CMakeFiles/cmTC_ce97b.dir/testCCompiler.c.o -o cmTC_ce97b
Detecting C compiler ABI info compiled with the following output:
Change Dir: /Users/timh/test/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_da9d3/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_da9d3.dir/build.make CMakeFiles/cmTC_da9d3.dir/build
Building C object CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o
/usr/local/opt/llvm/bin/clang -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -o CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o -c /usr/local/Cellar/cmake/3.10.2/share/cmake/Modules/CMakeCCompilerABI.c
Linking C executable cmTC_da9d3
/usr/local/Cellar/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_da9d3.dir/link.txt --verbose=1
/usr/local/opt/llvm/bin/clang -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -v -Wl,-v CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o -o cmTC_da9d3
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
Found CUDA installation: /usr/local/cuda, version unknown
"/usr/bin/ld" -demangle -lto_library /usr/local/Cellar/llvm/5.0.1/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_da9d3 -L/usr/local/opt/llvm/lib -search_paths_first -headerpad_max_install_names -rpath /usr/local/opt/llvm/lib -v CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o -lSystem /usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld PROJECT:ld64-302.3
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
Library search paths:
/usr/local/opt/llvm/lib
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
Parsed C implicit link information from above output:
link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
ignore line: [Change Dir: /Users/timh/test/build/CMakeFiles/CMakeTmp]
ignore line: []
ignore line: [Run Build Command:"/usr/bin/make" "cmTC_da9d3/fast"]
ignore line: [/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_da9d3.dir/build.make CMakeFiles/cmTC_da9d3.dir/build]
ignore line: [Building C object CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o]
ignore line: [/usr/local/opt/llvm/bin/clang -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -o CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o -c /usr/local/Cellar/cmake/3.10.2/share/cmake/Modules/CMakeCCompilerABI.c]
ignore line: [Linking C executable cmTC_da9d3]
ignore line: [/usr/local/Cellar/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_da9d3.dir/link.txt --verbose=1]
ignore line: [/usr/local/opt/llvm/bin/clang -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -v -Wl,-v CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o -o cmTC_da9d3 ]
ignore line: [clang version 5.0.1 (tags/RELEASE_501/final)]
ignore line: [Target: x86_64-apple-darwin16.0.0]
ignore line: [Thread model: posix]
ignore line: [InstalledDir: /usr/local/opt/llvm/bin]
ignore line: [Found CUDA installation: /usr/local/cuda, version unknown]
link line: [ "/usr/bin/ld" -demangle -lto_library /usr/local/Cellar/llvm/5.0.1/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_da9d3 -L/usr/local/opt/llvm/lib -search_paths_first -headerpad_max_install_names -rpath /usr/local/opt/llvm/lib -v CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o -lSystem /usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a]
arg [/usr/bin/ld] ==> ignore
arg [-demangle] ==> ignore
arg [-lto_library] ==> ignore, skip following value
arg [/usr/local/Cellar/llvm/5.0.1/lib/libLTO.dylib] ==> skip value of -lto_library
arg [-dynamic] ==> ignore
arg [-arch] ==> ignore
arg [x86_64] ==> ignore
arg [-macosx_version_min] ==> ignore
arg [10.11.0] ==> ignore
arg [-o] ==> ignore
arg [cmTC_da9d3] ==> ignore
arg [-L/usr/local/opt/llvm/lib] ==> dir [/usr/local/opt/llvm/lib]
arg [-search_paths_first] ==> ignore
arg [-headerpad_max_install_names] ==> ignore
arg [-rpath] ==> ignore
arg [/usr/local/opt/llvm/lib] ==> ignore
arg [-v] ==> ignore
arg [CMakeFiles/cmTC_da9d3.dir/CMakeCCompilerABI.c.o] ==> ignore
arg [-lSystem] ==> lib [System]
arg [/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a] ==> lib [/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a]
Library search paths: [;/usr/local/opt/llvm/lib;/usr/lib;/usr/local/lib]
Framework search paths: [;/Library/Frameworks/;/System/Library/Frameworks/]
remove lib [System]
remove lib [/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a]
collapse library dir [/usr/local/opt/llvm/lib] ==> [/usr/local/opt/llvm/lib]
collapse library dir [/usr/local/opt/llvm/lib] ==> [/usr/local/opt/llvm/lib]
collapse library dir [/usr/lib] ==> [/usr/lib]
collapse library dir [/usr/local/lib] ==> [/usr/local/lib]
collapse framework dir [/Library/Frameworks/] ==> [/Library/Frameworks]
collapse framework dir [/System/Library/Frameworks/] ==> [/System/Library/Frameworks]
implicit libs: []
implicit dirs: [/usr/local/opt/llvm/lib;/usr/lib;/usr/local/lib]
implicit fwks: [/Library/Frameworks;/System/Library/Frameworks]
Determining if the CXX compiler works passed with the following output:
Change Dir: /Users/timh/test/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_865d0/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_865d0.dir/build.make CMakeFiles/cmTC_865d0.dir/build
Building CXX object CMakeFiles/cmTC_865d0.dir/testCXXCompiler.cxx.o
/usr/local/opt/llvm/bin/clang++ -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -o CMakeFiles/cmTC_865d0.dir/testCXXCompiler.cxx.o -c /Users/timh/test/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_865d0
/usr/local/Cellar/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_865d0.dir/link.txt --verbose=1
/usr/local/opt/llvm/bin/clang++ -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib CMakeFiles/cmTC_865d0.dir/testCXXCompiler.cxx.o -o cmTC_865d0
Detecting CXX compiler ABI info compiled with the following output:
Change Dir: /Users/timh/test/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_39edf/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_39edf.dir/build.make CMakeFiles/cmTC_39edf.dir/build
Building CXX object CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o
/usr/local/opt/llvm/bin/clang++ -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -o CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/Cellar/cmake/3.10.2/share/cmake/Modules/CMakeCXXCompilerABI.cpp
Linking CXX executable cmTC_39edf
/usr/local/Cellar/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_39edf.dir/link.txt --verbose=1
/usr/local/opt/llvm/bin/clang++ -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -v -Wl,-v CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_39edf
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
Found CUDA installation: /usr/local/cuda, version unknown
"/usr/bin/ld" -demangle -lto_library /usr/local/Cellar/llvm/5.0.1/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_39edf -L/usr/local/opt/llvm/lib -search_paths_first -headerpad_max_install_names -rpath /usr/local/opt/llvm/lib -v CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld PROJECT:ld64-302.3
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
Library search paths:
/usr/local/opt/llvm/lib
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
Parsed CXX implicit link information from above output:
link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
ignore line: [Change Dir: /Users/timh/test/build/CMakeFiles/CMakeTmp]
ignore line: []
ignore line: [Run Build Command:"/usr/bin/make" "cmTC_39edf/fast"]
ignore line: [/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_39edf.dir/build.make CMakeFiles/cmTC_39edf.dir/build]
ignore line: [Building CXX object CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o]
ignore line: [/usr/local/opt/llvm/bin/clang++ -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -o CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/Cellar/cmake/3.10.2/share/cmake/Modules/CMakeCXXCompilerABI.cpp]
ignore line: [Linking CXX executable cmTC_39edf]
ignore line: [/usr/local/Cellar/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_39edf.dir/link.txt --verbose=1]
ignore line: [/usr/local/opt/llvm/bin/clang++ -I/usr/local/opt/llvm/include --target=x86_64-apple-darwin16.0.0 -mmacosx-version-min=10.11 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -v -Wl,-v CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_39edf ]
ignore line: [clang version 5.0.1 (tags/RELEASE_501/final)]
ignore line: [Target: x86_64-apple-darwin16.0.0]
ignore line: [Thread model: posix]
ignore line: [InstalledDir: /usr/local/opt/llvm/bin]
ignore line: [Found CUDA installation: /usr/local/cuda, version unknown]
link line: [ "/usr/bin/ld" -demangle -lto_library /usr/local/Cellar/llvm/5.0.1/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_39edf -L/usr/local/opt/llvm/lib -search_paths_first -headerpad_max_install_names -rpath /usr/local/opt/llvm/lib -v CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a]
arg [/usr/bin/ld] ==> ignore
arg [-demangle] ==> ignore
arg [-lto_library] ==> ignore, skip following value
arg [/usr/local/Cellar/llvm/5.0.1/lib/libLTO.dylib] ==> skip value of -lto_library
arg [-dynamic] ==> ignore
arg [-arch] ==> ignore
arg [x86_64] ==> ignore
arg [-macosx_version_min] ==> ignore
arg [10.11.0] ==> ignore
arg [-o] ==> ignore
arg [cmTC_39edf] ==> ignore
arg [-L/usr/local/opt/llvm/lib] ==> dir [/usr/local/opt/llvm/lib]
arg [-search_paths_first] ==> ignore
arg [-headerpad_max_install_names] ==> ignore
arg [-rpath] ==> ignore
arg [/usr/local/opt/llvm/lib] ==> ignore
arg [-v] ==> ignore
arg [CMakeFiles/cmTC_39edf.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
arg [-lc++] ==> lib [c++]
arg [-lSystem] ==> lib [System]
arg [/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a] ==> lib [/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a]
Library search paths: [;/usr/local/opt/llvm/lib;/usr/lib;/usr/local/lib]
Framework search paths: [;/Library/Frameworks/;/System/Library/Frameworks/]
remove lib [System]
remove lib [/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/lib/darwin/libclang_rt.osx.a]
collapse library dir [/usr/local/opt/llvm/lib] ==> [/usr/local/opt/llvm/lib]
collapse library dir [/usr/local/opt/llvm/lib] ==> [/usr/local/opt/llvm/lib]
collapse library dir [/usr/lib] ==> [/usr/lib]
collapse library dir [/usr/local/lib] ==> [/usr/local/lib]
collapse framework dir [/Library/Frameworks/] ==> [/Library/Frameworks]
collapse framework dir [/System/Library/Frameworks/] ==> [/System/Library/Frameworks]
implicit libs: [c++]
implicit dirs: [/usr/local/opt/llvm/lib;/usr/lib;/usr/local/lib]
implicit fwks: [/Library/Frameworks;/System/Library/Frameworks]
Edited by Tim