VS: Cannot create Assembly Listing files since 3.15.1
System
- Windows 10 Pro x64
- VS2019 (error also happens with VS2022)
- freshly downloaded zip version of cmake x86 (error also happens with x64) binary versions 3.15.0, 3.15.1, 3.25.2 and 3.26.0-rc1
Scenario
- We got a very simple example. Single Line DLL and single line static lib.
- One main CMakeLists.txt with 2 sub directories for a dll and static lib with their own CMakeLists.txt.
- We are using add_subdirectory() to include the 2 subprojects in the main project.
- We use target_compile_options() to set the "/FAcs" option to get the Assembly Listing files and the "/GL" option for code optimization.
- We create the project with cmake and then build it with Visual Studio 2019 (using cmake --build). See batch files for exact calling.
Results
For version 3.15.0 it works fine but any following version produces this error:
However if we include the sub project directly into the main CMakeLists.txt the build works fine in all versions.
Our tests were perfomed with Visual Studio 2019 and 2022. There is no difference with x86 and x64 build.
Please see the following matrix for our test results:
cmake version | 3.15.0 (no /GL) | 3.15.0 (with /GL) | 3.15.1 (no /GL) | 3.15.1 (with /GL) |
---|---|---|---|---|
using subdirectories | Works | Works | Works | ERROR |
using inlined configs | Works | Works | Works | Works |
You can reproduce the issue using the attached zip file. It includes the CMakeLists, CPPs and batch files (very small and simple).
We don't understand why restructuring our CMake hierarchy (inlining the add_subdirectories) prevents the linker error when using "/GL" option.
This issue currently prevents us from upgrading the compiler for our real 700.000 LOC project because VS2022 is not supported in 3.15.0
Any ideas what else we could try?