ein*_*ica 6 c++ cmake header-files buildconfiguration
In his Meeting C++ 2019 talk (and also in 2018), presenter Deniz Bahadir recommends that we specify targets' C++ header files using target_sources(), with some of them being PUBLIC or INTERFACE.
But - when I try to do that (using relative paths, like I used to with the good old add_target()), I get this kind of error:
CMake Warning (dev) at CMakeLists.txt:26 (target_sources):
Policy CMP0076 is not set: target_sources() command converts relative paths
to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
An interface source of target "cuda-api-wrappers" has a relative path.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
CMake Error in CMakeLists.txt:
Target "cuda-api-wrappers" INTERFACE_SOURCES property contains relative
path:
"src/cuda/api/miscellany.hpp"
Run Code Online (Sandbox Code Playgroud)
So, what, am I supposed to put the header file names in generator expressions or something? I certainly don't want absolute paths to my source dir ending up in the library's interface. This seems weird to me. Maybe I just should bother with the header files in target_sources() after all?
PS - Using CMake 3.13.4 on Devuan 3.
CMakeLists.txt如果指定以上版本,此错误就会消失3.13.0:
cmake_minimum_required(VERSION 3.13.0)
Run Code Online (Sandbox Code Playgroud)
来自官方文档:
| 归档时间: |
|
| 查看次数: |
5081 次 |
| 最近记录: |