CMake generated VS project expecting lib instead of dll

邮差的信 提交于 2020-01-15 07:19:32

问题


Here is my minimal example of below: https://www.dropbox.com/s/7fwsr3sigb60rtw/leveling-test.zip?dl=0

My current project folder structure and relevant CMakeLists content:

leveling
├── CMakeLists.txt: add_subdirectory(deps) 
└── deps
    ├── CMakeLists.txt: add_subdirectory(xml-reading)
    └── xml-reading
        ├── CMakeLists.txt: add_subdirectory(deps)
        │                   add_library(xml-reading ...)
        │                   target_include_directories(xml-reading PUBLIC ${CMAKE_CURRENT_LIST_DIR}/deps/tinyxml2)
        │                   target_link_libraries(xml-reading PUBLIC tinyxml2)
        └── deps
            ├── CMakeLists.txt: add_subdirectory(tinyxml2)
            └── tinyxml2

this generates a xml-reading.dll file.

But then the leveling project linker options have /DYNAMICBASE "bin\windows-32\debug\xml-reading.lib" "bin\windows-32\debug\BOBPrimitives.lib" "bin\windows-32\debug\tinyxml2d.lib"

Which yields: 2>LINK : fatal error LNK1104: cannot open file 'bin\windows-32\debug\xml-reading.lib'

What's up?

  • I tried adding SHARED to add_library(xml-reading SHARED ...), didn't help
  • As a workaround I set STATIC at add_library(xml-reading STATIC ...) to force it to produce a .lib file - but I'd like to understand what's going on

来源:https://stackoverflow.com/questions/53601141/cmake-generated-vs-project-expecting-lib-instead-of-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!