The following issue has been SUBMITTED. ====================================================================== https://cmake.org/Bug/view.php?id=16071 ====================================================================== Reported By: Itai Seggev Assigned To: ====================================================================== Project: CMake Issue ID: 16071 Category: CMake Reproducibility: always Severity: feature Priority: normal Status: new ====================================================================== Date Submitted: 2016-04-19 13:02 EDT Last Modified: 2016-04-19 13:02 EDT ====================================================================== Summary: CMake should map /Fd to COMPILE_PDB_NAME for static libraries Description: This is a follow up to https://cmake.org/Bug/view.php?id=14763 and its predecessors https://cmake.org/Bug/view.php?id=14060 / https://cmake.org/Bug/view.php?id=14062
/Fd was separated from PDB_NAME, because normally what we want is the linker pdb. However, if our final product is the static library, then we do want to the compiler PDB file, so COMPILE_PDB_NAME was added. Yet, a mapping was not added between COMPILE_PDB_NAME and /Fd. The result is /Fd is added to compile flags but COMPILE_PDB_NAME remains at its default value, and an inconsistency is created between Visual Studio and NMake generators. For the former, the flag is honored, but for the latter it is overridden by the NMake file's own specification of /Fd. Thus, for dlls and exes, you can simply add /PDB to the link flags, but for static libraries you must manually manipulate the COMPILE_PDB_NAME property for the target. I think that /Fd, certainly for static libraries which have no link step, should be mapped to COMPILE_PDB_NAME. Steps to Reproduce: Create a minimal CMakeLists.txt like the following: project(foo) add_library(myLib STATIC myLib.c) target_compile_options(myLib PUBLIC $<$<PLATFORM_ID:Windows>:/Zi /FdmyLib.pdb>) Generate a NMake Makefiles build system and build. You will see cl : Command line warning D9025 : overriding '/FdmyLib.pdb' with '/FdCMakeFiles\myLib.dir/' and the PDB file is indeed CMakeFiles\myLib.dir\vc120.pdb. If you generate a Visual Studio project and build, there is no warning and the pdb file is .\myLib.pdb. And indeed the pdb file will be ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2016-04-19 13:02 Itai Seggev New Issue ====================================================================== -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers