我有以下CMakeLists.txt
文件生成基於Qt我的項目:錯誤LNK1104:無法打開文件「調試 MyProjectLib.lib」
cmake_minimum_required(VERSION 2.8.12)
project(MyProject)
find_package(Qt5Widgets)
set(MyProjectLib_src ${PROJECT_SOURCE_DIR}/gui.cpp)
set(MyProjectLib_hdr ${PROJECT_SOURCE_DIR}/gui.h)
set(MyProjectLib_ui ${PROJECT_SOURCE_DIR}/gui.ui)
set(MyProjectBin_src ${PROJECT_SOURCE_DIR}/main.cpp)
qt5_wrap_cpp(MyProjectLib_hdr_moc ${MyProjectLib_hdr})
qt5_wrap_ui (MyProjectLib_ui_moc ${MyProjectLib_ui})
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_BINARY_DIR})
add_library(MyProjectLib SHARED
${MyProjectLib_src}
${MyProjectLib_hdr_moc}
${MyProjectLib_ui_moc}
)
target_link_libraries(MyProjectLib Qt5::Widgets)
add_executable(MyProject ${MyProjectBin_src})
target_link_libraries(MyProject MyProjectLib)
當我嘗試編譯生成的項目中,我得到了以下錯誤:
error LNK1104: cannot open file 'Debug\MyProjectLib.lib'
相應的目錄Debug
包含:
MyPtojectLib.dll
MyProjectLib.ilk
MyProjectLib.pdb
你會檢討我的其他職位,請 http://stackoverflow.com/questions/40746444/combining-two-solution-in - 酮使用-cmake的?noredirect = 1#comment68742304_40746444 – test11