gpt4 book ai didi

visual-studio-2013 - 生成 VS2013 构建时缺少 CMake 安装目标

转载 作者:行者123 更新时间:2023-12-02 04:54:04 28 4
gpt4 key购买 nike

我使用的是 CMake Guid 3.0.0 和 Visual Studio Express 2013(64 位)。我的 CMakeLists.txt 文件没有为我的 visual studio 构建生成 INSTALL 目标。我可以通过构建 ALL_BUILD 项目进行编译。然后我可以运行留在 Debug 和 Release 文件夹中的可执行文件。我需要添加什么才能构建 INSTALL 目标?

project(intraoperative_adjustments)

cmake_minimum_required(VERSION 2.8)

if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()

find_package(VTK COMPONENTS
vtkCommonCore
vtkFiltersCore
vtkInfovisCore
vtkInteractionStyle
vtkRenderingFreeTypeOpenGL
vtkIOGeometry
vtkViewsQt
)
include(${VTK_USE_FILE})

if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()

# Use the include path and library for Qt that is used by VTK.
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)

# Set your files and resources here
set( Srcs main.cxx SimpleView.cxx )

set( Hdrs SimpleView.h )

set( MOC_Hdrs SimpleView.h )

set( UIs SimpleView.ui )

set( QRCs Icons/icons.qrc )


# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

# The rest should just work (sure...)
if(VTK_QT_VERSION VERSION_GREATER "4")
# We have ui files, this will bring in the macro: qt5_wrap_ui
find_package(Qt5Widgets REQUIRED QUIET)
qt5_wrap_ui(UI_Srcs ${UIs})
qt5_add_resources(QRC_Srcs ${QRCs} )

source_group("Resources" FILES
${UIs}
${QRCs}
${EXE_ICON} # Not present
)

source_group("Generated" FILES
${UI_Srcs}
${MOC_Srcs}
${QRC_Srcs}
${QRC_Srcs}
)

add_executable(intraoperative_adjustments
${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${QRC_Srcs})
qt5_use_modules(intraoperative_adjustments Core Gui Widgets)
target_link_libraries(intraoperative_adjustments ${VTK_LIBRARIES})
else()
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
# Use what VTK built with
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
qt4_wrap_ui(UI_Srcs ${UIs})
qt4_wrap_cpp(MOC_Srcs ${MOC_Hdrs} )
qt4_add_resources(QRC_Srcs ${QRCs})

source_group("Resources" FILES
${UIs}
${QRCs}
${EXE_ICON} # Not present
)

source_group("Generated" FILES
${UI_Srcs}
${QRC_Srcs}
${QRC_Srcs}
)

add_definitions(-DQT_GUI_LIBS -DQT_CORE_LIB -DQT3_SUPPORT)

add_executable(intraoperative_adjustments
${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${QRC_Srcs})
target_link_libraries(intraoperative_adjustments
${QT_LIBRARIES}
${VTK_LIBRARIES}
)
endif()

最佳答案

您必须使用 CMake 的 install 命令创建 INSTALL 目标。参见根据CMake documentation了解更多详情。

关于visual-studio-2013 - 生成 VS2013 构建时缺少 CMake 安装目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24770207/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com