【问题标题】:Cannot use assimp library in Debug build configuration无法在调试构建配置中使用 assimp 库
【发布时间】:2021-02-12 10:19:23
【问题描述】:

我在我的项目中使用来自导入目标 assimp::assimp 的库 Assimp:

find_package(assimp REQUIRED 5)
target_link_libraries(${PROJECT_NAME} PUBLIC assimp::assimp)

在Debug 配置中构建项目的链接阶段,我收到一个错误:

src/renderer/CMakeFiles/renderer.dir/build.make:256: *** 目标模式不包含“%”。停下来。

错误的原因是(在 Archlinux 上)我没有 /usr/lib/cmake/assimp-5.0/assimpTargets-debug.cmake 和 /usr/lib/cmake/assimp-5.0/assimpTargets.cmake 中的相应行。属性IMPORTED_CONFIGURATIONS 的assimp::assimp 目标只有RELEASE 值并且没有IMPORTED_LOCATION_DEBUG 属性,只有IMPORTED_LOCATION_RELEASE。

【问题讨论】:

    标签: cmake assimp


    【解决方案1】:

    要解决问题需要添加:

    set_target_properties(assimp::assimp PROPERTIES MAP_IMPORTED_CONFIG_DEBUG Release)
    

    就在find_package之后。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-03
      • 2021-04-15
      • 2021-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-01
      • 1970-01-01
      相关资源
      最近更新 更多