I build my project using cmake (It is important for me to work both generators: Ninja and Visual Studio). And I need to add assimp library to my project. So, I added assimp from git to my project as git submodule and as suggested in the docs I added this lines to my CMake:
add_subdirectory(assimp)
target_link_libraries(project assimp)
I don't understand:
By default assimp compiles as shared lib, so why I should use
target_link_libraries(rt assimp)
, if as far as i know it's link my executable with static library? And anyway after this linkage my .exe requires .dll.Also, as alternative, I tried to compile assimp as static lib, as specified in the documentation I should use
set(BUILD_SHARED_LIBS OFF)
. I added this flag to my main CMakeLists.txt. But it still compiles two files:
- bin/Debug/assimp.dll
- lib/Debug/assimp.lib
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(assimp)
target_link_libraries(project assimp)
I thought that I could choose one of them, but no: after linkage with static lib (target_link_libraries(rt assimp)
) it's anyway requires .dll.
Note: .dll is uncomfortable for me, because I don't want to move the .dll to my .exe directory everytime. Also, variants like donwloading assimp from vcpkg or adding .dll to PATH don't work to me, because my main goal is: the user should just clone my git repo and compile the whole project with all dependecies using only one my CMakeLists.txt without additional actions.