如何确保 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")
在这个小脚本中,我想用src
foler 中的CMakeLists.txt 文件生成动态库,然后我将库的属性 设置在顶部CMakeLists.txt。但是,它似乎不起作用,因为我有以下错误:
set_property cannot find Target "mytest". Perhaps it has been created yet.
解决此问题的一个方法是将 set_property 放在创建动态库 (src/CMakeLists.txt
) 的 CMakeLists.txt 中。如果我坚持把它放在顶级 CMakeLists.txt 文件中,我该怎么办?谢谢。
不要使用已弃用的命令subdirs. Everything works when it is replaced by add_subdirectory
举个小例子来说明我的问题:
project(Test)
set(TestLibName mytest)
subdirs(src) # will generate mytest.dll dynamic library
set_property(TARGET ${TestLibName} PROPERTY FOLDER "test")
在这个小脚本中,我想用src
foler 中的CMakeLists.txt 文件生成动态库,然后我将库的属性 设置在顶部CMakeLists.txt。但是,它似乎不起作用,因为我有以下错误:
set_property cannot find Target "mytest". Perhaps it has been created yet.
解决此问题的一个方法是将 set_property 放在创建动态库 (src/CMakeLists.txt
) 的 CMakeLists.txt 中。如果我坚持把它放在顶级 CMakeLists.txt 文件中,我该怎么办?谢谢。
不要使用已弃用的命令subdirs. Everything works when it is replaced by add_subdirectory