如何确保 CMAKE 代码将在子目录之后运行
how to make sure that cmake codes will run after subdirs
举一个小例子来说明我的问题:
project(Test)
set(TestLibName mytest)
subdirs(src) # will generate mytest.dll dynamic library
set_property(TARGET ${TestLibName} PROPERTY FOLDER "test")
在这个小脚本中,我想使用 CMakeLists.txt 文件生成动态库 src
foler,之后我将在顶部 CMakeLists.txt 中设置库的属性。但是,它似乎不起作用,因为我有以下错误:
set_property cannot find Target "mytest". Perhaps it has been created yet.
解决此问题的一种解决方案是将set_property放在创建动态库 (src/CMakeLists.txt
) 的 CMakeList 中.txt 的 CMakeList 中。如果我坚持把它放在顶级CMakeLists.txt文件中,我该怎么办?谢谢。
不要使用已弃用的命令子目录。当它被add_subdirectory替换时,一切正常
相关文章:
- 为什么在popback()操作之后,它仍然打印完整的矢量
- 在类定义之后定义一个私有方法
- 在循环C++中指定字符串之后,不会打印该字符串
- 子目录是否继承属性,例如add_definitions,include_directories和父Cmakelist.t
- C++宏忽略之后的内容
- 要与"if constexpr"一起使用的编译时消息(在预处理器之后)
- 在子目录中使用target_sources()命令时用于单元测试(qtest)的项目结构
- strncpy之后的char数组的错误行为
- 计算十进制 c++ 之后的数字
- 我怎样才能将所有子目录与 cmake 自动匹配
- "x += x--"之后的 x 是什么?
- 类的前向声明之后的类成员函数定义,在类声明之前
- 为什么将双精度转换为 int 似乎在第 16 位数字之后将其四舍五入?
- execlp() 在 fork() 之后无法正常工作
- 使文件夹中的所有文件可供所有项目(子目录)访问
- 我认为我的代码很好,但它在 cin a 之后停止并且没有进一步?
- 如何在MISRA C++之后实施CRTP
- 从所有列出的文件和子目录中更改目录
- 在 OpenCV 的 namedWindow 之前或之后初始化 Tesseract
- 如何确保 CMAKE 代码将在子目录之后运行