在我的 CMakeLIsts.txt 文件中我这样写:
set(LIBHELLO_SRC hello.c)
set_target_properties(hello_static PROPERTIES OUTPUT_NAME "hello")
get_target_property(OUTPUT_VALUE hello_static OUTPUT_NAME)
message(STATUS "This is the hello_static OUTPUT_NAME:"${OUTPUT_VALUE})
当我跑步时cmake
,它显示错误消息:
set_target_properties Can not find target to add properties to: hello_static
为了让你的代码正常工作,hello_static
must是 CMake 目标的名称;通过添加的东西add_executable http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command%3aadd_executable or add_library http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command%3aadd_library例如命令。
这与您的项目名称无关。
看起来你错过了类似的东西:
add_library(hello_static ${LIBHELLO_SRC})
它将立即放置在
set(LIBHELLO_SRC hello.c)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)