【问题标题】:CMake Qt module disables exception handlingCMake Qt 模块禁用异常处理
【发布时间】:2014-09-21 10:02:49
【问题描述】:

我的 CMakeLists.txt 包含:

find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)

if (${QT4_FOUND})
    include(${QT_USE_FILE})
    include_directories(${QT_INCLUDE_DIR})
endif ()

find_package(KDE4 REQUIRED)

if (${KDE4_FOUND})
    include(KDE4Defaults)
    include_directories(${KDE4_INCLUDE_DIR} ${KDE4_INCLUDES})
    link_directories(${KDE4_LIB_DIR})
endif ()

在构建过程中它说:

error: exception handling disabled, use -fexceptions to enable

前段时间我记得这个问题,我怀疑 Qt 会添加编译选项,但为什么呢?

【问题讨论】:

    标签: c++ qt cmake kde


    【解决方案1】:

    我想您需要启用例外。您可以在 CMakeLists.txt 的下一行添加标志:

    add_definitions( -Wall -O2 -fexceptions )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-04
      • 1970-01-01
      • 2018-06-02
      • 1970-01-01
      • 1970-01-01
      • 2013-03-08
      • 2012-07-22
      • 1970-01-01
      相关资源
      最近更新 更多