本文介绍了配置“为可执行目标"assimp_simpletexturedogl"没有给定运行时目的地的安装目标而给定“安装目标"时的CMake错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to use CMake to configure assimp's samples

但是配置时会出错

我尝试了很多方法,但是没有人起作用.

I've tried lot's of method but no one works.

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,任何想法都将不胜感激.

Here is my CMakeLists.txt, any idea would be appreciate.

我正在使用MSVC2013进行编译.

I'm using MSVC2013 to compile.

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
) 

推荐答案

您忘记为可执行文件指定文件夹.试试这个:

You forgot to indicate a folder for the executable. Try this:

INSTALL( 

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

我不知道为什么在cMake中要求为可执行文件具有放置文件夹(在我的示例中为bin),但这是这里的问题.

I don't know why in cMake is a requirement to have a drop folder ( bin in my example ) for the executable, but this is the problem here.

这篇关于配置“为可执行目标"assimp_simpletexturedogl"没有给定运行时目的地的安装目标而给定“安装目标"时的CMake错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 01:52