• cmake使用(CMakeList.txt)


    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    #CMAKE_INCLUDE_CURRENT_DIR equal to INCLUDE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
    CMAKE_INCLUDE_CURRENT_DIR

    Automatically add the current source- and build directories to the include path.

    If this variable is enabled, CMake automatically adds in each directory ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} to the include path for this directory. These additional include directories do not propagate down to subdirectories. This is useful mainly for out-of-source builds, where files generated into the build tree are included by files located in the source tree.

    By default CMAKE_INCLUDE_CURRENT_DIR is OFF.

    --------------------------------------------------------------------------------
    set(CMAKE_AUTOMOC ON)
    CMAKE_AUTOMOC: This variable is used to initialize the AUTOMOC property on all the targets
    AUTOMOC is a boolean specifying whether CMake will handle the Qt moc preprocessor automatically

     qt中moc的作用
     Qt 将源代码交给标准 C++ 编译器,如 gcc 之前,需要事先将这些扩展的语法去除掉。完成这一操作的就是 moc。
    moc 全称是 Meta-Object Compiler,也就是“元对象编译器”。Qt 程序在交由标准编译器编译之前,先要使用 moc 分析 C++ 源文件。如果它发现在一个头文件中包含了宏 Q_OBJECT,则会生成另外一个 C++ 源文件。这个源文件中包含了 Q_OBJECT 宏的实现代码。这个新的文件名字将会是原文件名前面加上 moc_ 构成。这个新的文件同样将进入编译系统,最终被链接到二进制代码中去。因此我们可以知道,这个新的文件不是“替换”掉旧的文件,而是与原文件一起参与编译。另外,我们还可以看出一点,moc 的执行是在预处理器之前。因为预处理器执行之后,Q_OBJECT 宏就不存在了。

    在命令行下输入moc yourfilename.h -o moc_youfilename.cpp生成不带Q_OBJENT的源文件。

  • 相关阅读:
    Redis 集群方案
    Redis集群搭建
    Java并发问题--乐观锁与悲观锁以及乐观锁的一种实现方式-CAS
    为什么分布式一定要有Redis?
    如何准备Java初级和高级的技术面试
    SpringBoot自动配置原理
    高德地图-- 云图管理台
    GeoJSON格式规范说明
    webGis概念
    npm压缩js文件
  • 原文地址:https://www.cnblogs.com/cj2014/p/6163272.html
Copyright © 2020-2023  润新知