Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Configuration CMake配置时出错";安装目标时未指定可执行目标的运行时目标";assimp“u simpletexturedogl”&引用;_Configuration_Cmake_Makefile_Assimp_Cmake Gui - Fatal编程技术网

Configuration CMake配置时出错";安装目标时未指定可执行目标的运行时目标";assimp“u simpletexturedogl”&引用;

Configuration CMake配置时出错";安装目标时未指定可执行目标的运行时目标";assimp“u simpletexturedogl”&引用;,configuration,cmake,makefile,assimp,cmake-gui,Configuration,Cmake,Makefile,Assimp,Cmake Gui,我正在尝试使用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:

我正在尝试使用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
) 

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

INSTALL( 

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

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

今晚我遇到了这个问题,在cmake的速成课程之后,我尝试了cmake--trace expand,它显示了一组变量是空的,包括${ASSIMP\u BIN\u INSTALL\u DIR}

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

从源代码构建ASIMP 3.2是必要的,cmake为此做得很好。我还选择编辑输出文件名以排除-mtd-130,即将它们设置为从项目默认值继承


它对我很有用,希望在样本cmakelist文件更新之前能帮助到其他人。

我只需执行以下操作即可实现此功能:

mkdir build
cd build
cmake .. -DASSIMP_BIN_INSTALL_DIR=`pwd`
例如:

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
)
与此相关