ogre
ogre copied to clipboard
MSVC Debug build expects assimp release library to be present
Reproducer on Windows 10 64Bit, VS2019:
- Get current master code
- Create a build directory
- Build using 'cmake -DCMAKE_BUILD_TYPE=Debug ..'
=> The build fails on:
CMake Error at build_debug/Dependencies/lib/cmake/assimp-5.0/assimpTargets.cmake:85 (message): The imported target "assimp::assimp" references the file
"H:/Code/Ogre/ogre-master/build_debug/Dependencies/lib/assimp-vc142-mt.lib"
but this file does not exist.
The mentioned directory correctly contains assimp-vc142-mtd.lib, but the build seems to be looking for the release libary instead
The target and file in question is generated by assimp, so you rather should file an issue there.
I believe I have found the issue in the Ogre CMake files:
The following line removes the script which finds the debug library:
https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMake/Dependencies.cmake#L218-L220
`OGRE_DEBUG_MODE is set in:
https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMake/ConfigureBuild.cmake#L15-L19
However, the Dependencies script is included way before the ConfigureBuild script in the main CMakeLists
(Compare https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMakeLists.txt#L290 and https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMakeLists.txt#L436).
Additionally, it looks like in debug mode, the assimpTargets-release.cmake had to be removed instead, as CMake will otherwise look for both the debug and release libraries
I can confirm that changing OgreDependencies.cmake to:
if(NOT OGRE_DEBUG_MODE)
file(REMOVE ${OGREDEPS_PATH}/lib/cmake/assimp-5.0/assimpTargets-debug.cmake)
else()
file(REMOVE ${OGREDEPS_PATH}/lib/cmake/assimp-5.0/assimpTargets-release.cmake)
endif()
and setting OGRE_DEBUG_MODE to 1 anywhere before that line fixes this issue. I'm not really sure which kind of place would be the right one for setting OGRE_DEBUG_MODE, though. Also, this would break a debug and release build, in case it is supported anyway.
thanks for investigating.
however, for ogre this is merely a workaround. This change should actually be made in the assimp project.
fixed in assimp