有没有办法获取所有add_library()
来电的名字? E.g。
add_library(lib1
some.cpp
)
add_library(lib2
some.cpp
)
add_library(lib3
some.cpp
)
# And then somehow get in a variable MY_LIBRARIES_NAMES = lib1 lib2 lib3
是否有任何cmake调用或变量可以做到这一点? (如果重要的话,我对cmake 2.8版感兴趣)
谢谢!
答案 0 :(得分:1)
在较新版本的CMake(> =版本3.7)中,它将是BUILDSYSTEM_TARGETS
目录属性:
add_library()
对于旧版本的CMake,您可以覆盖macro(add_library _target)
_add_library(${_target} ${ARGN})
set_property(GLOBAL APPEND PROPERTY GlobalTargetList ${_target})
endmacro()
...
get_property(_allTargets GLOBAL PROPERTY GlobalTargetList)
message(STATUS "GlobalTargetList: ${_allTargets}")
来回收集目标列表:
routes.MapHttpRoute(
"Api action",
"Api/{controller}/{action}"
);
routes.MapHttpRoute(
"Api get",
"Api/{controller}"
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapHttpRoute(
"DistGroupRoute",
"api/distributiongroup/{id}/{action}",
new { controller = "DistributionGroup", action = "Index" }
);
<强>参考强>