assimp
assimp copied to clipboard
Fix to correctly determine 'multi-configuration' on Windows
Probrem
An error occurs during the build and installation on Windows with the BUILD_SHARED_LIBS option set to OFF because assimp-vc143-mtd.pdb cannot be found.
Cause
Seems to be caused by an error in the following if command in code/CMakeLists.txt.
https://github.com/assimp/assimp/blob/10e97b2f4ae2d7b9b2bbe0ee6ce3fe91bd3b52e4/code/CMakeLists.txt#L1578
Since GENERATOR_IS_MULTI_CONFIG is a property, not a variable, it doesn't work correctly when specified directly in the if command.
Solution
The value of GENERATOR_IS_MULTI_CONFIG is assigned to the variable is_multi_config elsewhere. This PR resolves the probrem by using the value of this variable.
Command line
The command line that results in a installation error is shown below.
c:\Users\kenic\Documents\dev\assimp>mkdir build
c:\Users\kenic\Documents\dev\assimp>cd build
c:\Users\kenic\Documents\dev\assimp\build>cmake .. -DBUILD_SHARED_LIBS=OFF
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.41.34120.0
-- The CXX compiler identification is MSVC 19.41.34120.0
<<snip>>
-- Configuring done (5.7s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/kenic/Documents/dev/assimp/build
c:\Users\kenic\Documents\dev\assimp\build>cmake --build . --config Debug
MSBuild version 17.11.2+c078802d4 for .NET Framework
1>Checking Build System
Building Custom Rule C:/Users/kenic/Documents/dev/assimp/contrib/zlib/CMakeLists.txt
adler32.c
<<snip>>
gtest-all.cc
unit.vcxproj -> C:\Users\kenic\Documents\dev\assimp\build\bin\Debug\unit.exe
Building Custom Rule C:/Users/kenic/Documents/dev/assimp/CMakeLists.txt
c:\Users\kenic\Documents\dev\assimp\build>cmake --install . --config Debug --prefix out
-- Installing: C:/Users/kenic/Documents/dev/assimp/build/out/lib/cmake/assimp-5.4/assimpConfig.cmake
<<snip>>
-- Installing: C:/Users/kenic/Documents/dev/assimp/build/out/include/assimp/Compiler/pstdint.h
CMake Error at code/cmake_install.cmake:148 (file):
file INSTALL cannot find
"C:/Users/kenic/Documents/dev/assimp/build/code/assimp-vc143-mtd.pdb": File
exists.
Call Stack (most recent call first):
cmake_install.cmake:81 (include)