Search code examples
c++cmakeconanassimp

CMake with Conan cannot find assimp-vc142-mt.lib


I'm trying to link assimp into a simple C++ project using Conan and CMake. However, when I build, it's giving me the following error:

LINK : fatal error LNK1104: cannot open file 'assimp-vc142-mt.lib' [C:\dev\test0\build\test.vcxproj]

Here is my conan default profile:

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
build_type=Release
[options]
[build_requires]
[env]

I've made sure to use the same architecture for installing with Conan and building with CMake. I've double checked that the library is installed. I've installed other libraries (e.g. glfw) with no issues. Is this an issue with the Conan package, or am I missing something?


Solution

  • https://github.com/conan-io/conan-center-index/issues/7342

    I had the CMake directives in the wrong order. You must do conan_basic_setup() before creating your executable and linking any libraries.