Jon*_*an. 5 c++ makefile cmake
我有一个目录结构如下:
root
libA
CMakeLists.txt
ClassA.cpp
libB
CMakeLists.txt
ClassB.cpp
sharedCode
enums.h
AbstractClass.h
Run Code Online (Sandbox Code Playgroud)
在 CMake 文件中如何包含 sharedCode 目录?这样 classA(在 libA 中)和 classB(在 libB 中)都可以使用 enums.h 和 AbstractClass.h?
在 CMakeLists.txt 我尝试使用:
add_subdirectory(../sharedCode)
Run Code Online (Sandbox Code Playgroud)
但它给出了错误
add_subdirectory not given a binary directory but the given source
directory "/root/sharedCode" is not
a subdirectory of "root/libA". When
specifying an out-of-tree source a binary directory must be explicitly
specified.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2912 次 |
| 最近记录: |