zoukankan      html  css  js  c++  java
  • cmake下cmake_c_flags,add_definitions

    cmake_c_flags用来设置编译选项 如 -g -wall(不展示警告)

    add_definitions

    添加编译参数,比如add_definitions(-DDEBUG)将在gcc命令行添加DEBUG宏定义

    ADD_LIBRARY (hello SHARED ${LIBHELLO_SRC})

    # 添加静态库,关键词为static,

    # ADD_LIBRARY (hello STATIC ${LIBHELLO_SRC})

    # 仍然用hello作为target名时,是不能成功创建所需的静态库的,

    # 因为hello作为一个target是不能重名的, 故把上面的hello修改为hello_static

    # 同理,你不需要写全libhello_static.a

    # 只需要填写hello即可,cmake系统会自动为你生成 libhello_static.X

    ADD_LIBRARY (hello_static STATIC ${LIBHELLO_SRC})

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

    # 即:静态库名为 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)

  • 相关阅读:
    CSS Sprite
    使用float和display:block将内联元素转换成块元素的不同点
    [POJ 1185] 炮兵阵地
    [POJ 1947] Rebuilding Roads
    [HDU 1561] The more, The Better
    [HDU 1011] Starship Troopers
    [POJ 1155] TELE
    [HDU 2196] Computer
    [HDU 1520] Anniversary party
    [HDU 5029] Relief grain
  • 原文地址:https://www.cnblogs.com/wangshaowei/p/12071004.html
Copyright © 2011-2022 走看看