davisking / davisking/dlib

Build on macOS with LLVM 9.0.1 Clang Compiler

Open
#2,009 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
14.4k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

Hi @davisking,

building dlib 19.19 on macOS with LLVM 9.0.1 Clang complier fails, because of the `target_compile_features` command which was introduced in CMake version 3.1.

## Expected Behavior

Build and install dlib 19.19 on macOS with default options.

## Current Behavior

Build fails [here](https://github.com/davisking/dlib/blob/3a53c78ad200c99581a9e064037dfb2502962cfb/dlib/cmake_utils/use_cpp_11.cmake#L74)

## Steps to Reproduce

1. Download dlib 19.19
2. Go into the examples folder and type: `mkdir build; cd build; cmake .. ; cmake --build .`
3. Build fails [here](https://github.com/davisking/dlib/blob/3a53c78ad200c99581a9e064037dfb2502962cfb/dlib/cmake_utils/use_cpp_11.cmake#L74) with:

```
CMake Error at dlib/cmake_utils/use_cpp_11.cmake:74 (target_compile_features):
target_compile_features no known features for CXX compiler

"Clang"

version 9.0.1.
Call Stack (most recent call first):
dlib/CMakeLists.txt:858 (enable_cpp11_for_target)

-- Building a C++11 test project to see if your compiler supports C++11
-- C++11 activated.
-- Configuring incomplete, errors occurred!
```

## Suggestion
Adding this:
```
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
```
between [here](https://github.com/davisking/dlib/blob/3a53c78ad200c99581a9e064037dfb2502962cfb/CMakeLists.txt#L2) solves the problem. I tried also adding this into the `use_cpp_11.cmake` but has no effect.

* **Version**:
dlib 19.19
* **Where did you get dlib**:
Downloaded source from GitHub
* **Platform**:
macOS (Catalina 10.15.2 (19C57))
* **Compiler**:
LLVM 9.0.1 Clang
CMake 3.16.4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.