I'm trying to compile gtest with the help of CMake and VS2015. I have found that no pdb file is generated in the output folder. Let's try to solve this issue.
We're using CMake, Visual Studio to compile google test with the versions listed below:
Util | Version | Downloading URL |
---|---|---|
CMake | 3.12.0 | https://cmake.org/files/v3.12/cmake-3.12.0-win64-x64.msi |
VS 2015 | 14.0 | https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409 |
google test | 1.8.0 | https://github.com/google/googletest/archive/release-1.8.0.zip |
We tried CMake 3.11.4 as well and then inferred that this might be a bug in cmake, so we upgraded it, but it didn't work either.
google test folder, run the following command to generate sln file:
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015"
build\googletest-distribution.sln
ALL_BUILD
with Debug config, we could find the lib and pdb files generated in build\googlemock\gtest\Debug
ALL_BUILD
with RelWithDebInfo again, we could find the lib file in build\googlemock\gtest\RelWithDebInfo
, but no pdb filelib:
gtest.lib(gtest-all.obj) : warning LNK4099: PDB'gtest.pdb' was not found with 'gtest.lib(gtest-all.obj)' or at 'D:\src\ut\x64\Release\gtest.pdb'; linking object as if no debug info
means that the pdb file is also generated for RelWithDebInfo configuration, but not copied to the output folder
At this point, we might get this idea directly: search pdb files in build folder and we could find the pdb file is located in the following folder:
build\googlemock\gtest\gtest.dir\RelWithDebInfo
This location could also be found in gtest project property, the pdb file will be copied to the same folder with the lib file if we change the $(IntDir) to $(OutDir):
So far, it is clear that the project generated by CMake does not copy pdb files to the output folder. We found that CMake had the same issue before when we search this problem online, but this issue is not solved in the latest version currently.
The pdb files are not copied to the output folder automatically using the solution generated by CMake with the RelWithDebInfo configuration. We should locate the files or modify the generated project property manually.