【问题标题】:CMake error while configuring "install TARGETS given no RUNTIME DESTINATION for executable target "assimp_simpletexturedogl"."配置“安装 TARGETS 时出现 CMake 错误,因为可执行目标“assimp_simpletexturedogl”没有运行时间目标。”
【发布时间】:2015-08-27 23:06:21
【问题描述】:

我正在尝试使用 CMake 来配置 assimp 的示例

但配置时出现一些错误

我尝试了很多方法,但没有一个有效。

CMake Error at CMakeLists.txt:41 (INSTALL):
      install TARGETS given no RUNTIME DESTINATION for executable target
      "assimp_simpletexturedogl".


    CMake Warning (dev) in CMakeLists.txt:
      No cmake_minimum_required command is present.  A line of code such as

        cmake_minimum_required(VERSION 3.2)

      should be added at the top of the file.  The version specified may be lower
      if you wish to support older CMake versions for this project.  For more
      information run "cmake --help-policy CMP0000".
    This warning is for project developers.  Use -Wno-dev to suppress it.

    Configuring incomplete, errors occurred!
    See also "D:/OpenGL/assimp-3.1.1-win-binaries/samples/SimpleTexturedOpenGL/made/CMakeFiles/CMakeOutput.log".

这是我的 CMakeLists.txt,任何想法都将不胜感激。

我正在使用 MSVC2013 进行编译。

FIND_PACKAGE(OpenGL)
FIND_PACKAGE(GLUT)

IF ( NOT GLUT_FOUND )
    IF ( MSVC )
        SET ( GLUT_FOUND 1 )
        SET ( GLUT_INCLUDE_DIR ${Assimp_SOURCE_DIR}/samples/glut/ )
        SET ( GLUT_LIBRARIES ${Assimp_SOURCE_DIR}/samples/glut/glut32.lib )
    ELSE ( MSVC )
        MESSAGE( WARNING "Please install glut." )
    ENDIF ( MSVC )
ENDIF ( NOT GLUT_FOUND )

INCLUDE_DIRECTORIES(
    ${Assimp_SOURCE_DIR}/include
    ${Assimp_SOURCE_DIR}/code
    ${OPENGL_INCLUDE_DIR}
    ${GLUT_INCLUDE_DIR}
    ${Assimp_SOURCE_DIR}/samples/DevIL/include/
)

LINK_DIRECTORIES( 
    ${Assimp_BINARY_DIR} 
    ${Assimp_BINARY_DIR}/lib/
    ${Assimp_SOURCE_DIR}/samples/DevIL/lib/
)

ADD_EXECUTABLE( assimp_simpletexturedogl WIN32
    SimpleTexturedOpenGL/include/boost_includes.h
    SimpleTexturedOpenGL/src/model_loading.cpp
)

SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX})

TARGET_LINK_LIBRARIES( assimp_simpletexturedogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} DevIL.lib )

SET_TARGET_PROPERTIES( assimp_simpletexturedogl PROPERTIES
    OUTPUT_NAME assimp_simpletexturedogl
)

INSTALL( TARGETS assimp_simpletexturedogl
    DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev
) 

【问题讨论】:

    标签: configuration cmake makefile assimp cmake-gui


    【解决方案1】:

    您忘记指定可执行文件的文件夹。试试这个:

    INSTALL( 
    
         TARGETS assimp_simpletexturedogl
         RUNTIME DESTINATION bin
         DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev
    ) 
    

    我不知道为什么在 cMake 中需要为可执行文件提供一个放置文件夹(在我的示例中为 bin),但这就是问题所在。

    【讨论】:

      【解决方案2】:

      今晚我遇到了这个问题,在 cmake 的速成课程之后,我尝试了 cmake --trace-expand,它显示一堆变量是空白的,包括 ${ASSIMP_BIN_INSTALL_DIR}。

      此时我刚刚用vs2015社区加载了.sln文件,让它升级,然后手动设置需要的东西。

      从源代码构建 assimp 3.2 是必要的,并且 cmake 可以正常工作。我还选择编辑输出文件名以排除 -mtd-130,即将它们设置为从项目默认值继承。

      它对我有用,希望在更新示例 cmakelist 文件之前对某人有所帮助。

      【讨论】:

        【解决方案3】:

        我只需执行以下操作即可完成此操作:

        mkdir build
        cd build
        cmake .. -DASSIMP_BIN_INSTALL_DIR=`pwd`
        

        【讨论】:

          【解决方案4】:

          例如:

          install(TARGETS snappy
                  EXPORT SnappyTargets
                  # RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # DESTINATION error
                  RUNTIME DESTINATION bin ${CMAKE_INSTALL_BINDIR} # should add bin or other dir
                  LIBRARY DESTINATION lib ${CMAKE_INSTALL_LIBDIR}
                  # ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR # DESTINATION error
                  ARCHIVE DESTINATION lib ${CMAKE_INSTALL_LIBDIR} # should add lib
          )
          

          与此question相关

          【讨论】:

            【解决方案5】:

            如果有人使用 Linux 和cmake 版本< 3.16

            只需在INSTALL( ) 参数中添加RUNTIME DESTINATION bin。这对我有用:

            INSTALL(
                 TARGETS AtomicParsley
                 RUNTIME DESTINATION bin
            ) 
            

            【讨论】:

              猜你喜欢
              • 2018-09-19
              • 2022-01-04
              • 1970-01-01
              • 2013-02-06
              • 2014-08-27
              • 1970-01-01
              • 2022-12-18
              • 1970-01-01
              • 2023-01-25
              相关资源
              最近更新 更多