cmake之set_target_properties

The command knife is often used in cmake, such as:

# 按照一般的习惯,静态库名字跟动态库名字应该是一致的,只是扩展名不同;

# 即:静态库名为 libhello.a; 动态库名为libhello.so ;

# 所以,希望 "hello_static" 在输出时,不是"hello_static",而是以"hello"的名字显示,故设置如下:

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})

CMD#42 : get_target_property 从一个目标中获取一个属性值。

get_target_property(VAR target property)

  Get the property value from a target . The value of the property will be stored in the variable VAR . If the property is not found, VAR will be set to NOTFOUND. Use the set_target_properties command to set property values. Property values ​​are generally used to control how a target is constructed, but some properties are used to query information about the target. This command can get the properties of any target that has been built so far. The target does not necessarily exist in the current CMakeLists.txt file.

http://blog.csdn.net/lcj_cjfykx/article/details/38186151

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325652330&siteId=291194637