Merge topic 'vs-no-compiler-pdb-setting'
87c0d16
Ninja: Fix OBJECT_DIR placeholder path conversionfb9f73d
MSVC: Invoke 'link' directly for executables42ba1b0
VS: Separate compiler and linker PDB files (#11899, #14062)
This commit is contained in:
commit
1b4b64cd3c
|
@ -81,7 +81,7 @@ endif()
|
|||
|
||||
macro(__windows_compiler_intel lang)
|
||||
set(CMAKE_${lang}_COMPILE_OBJECT
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> /Fd<OBJECT_DIR>/ <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
|
||||
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
|
@ -91,7 +91,7 @@ macro(__windows_compiler_intel lang)
|
|||
set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
|
||||
set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
|
||||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /RTC1")
|
||||
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1")
|
||||
|
|
|
@ -228,7 +228,7 @@ macro(__windows_compiler_msvc lang)
|
|||
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
|
||||
|
||||
set(CMAKE_${lang}_COMPILE_OBJECT
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/ -c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
|
||||
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
|
||||
|
@ -237,7 +237,7 @@ macro(__windows_compiler_msvc lang)
|
|||
set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
|
||||
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> <OBJECTS> /link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
|
||||
|
|
|
@ -1252,7 +1252,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
|
|||
|
||||
cm->DefineProperty
|
||||
("CMAKE_PDB_OUTPUT_DIRECTORY", cmProperty::VARIABLE,
|
||||
"Where to put all the MS debug symbol files.",
|
||||
"Where to put all the MS debug symbol files from linker.",
|
||||
"This variable is used to initialize the "
|
||||
"PDB_OUTPUT_DIRECTORY property on all the targets. "
|
||||
"See that target property for additional information.",
|
||||
|
|
|
@ -838,16 +838,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
|
|||
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX");
|
||||
fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
|
||||
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
|
||||
if(targetBuilds)
|
||||
{
|
||||
// We need to specify a program database file name even for
|
||||
// non-debug configurations because VS still creates .idb files.
|
||||
fout << "\t\t\t\tProgramDataBaseFileName=\""
|
||||
<< this->ConvertToXMLOutputPathSingle(
|
||||
target.GetPDBDirectory(configName).c_str())
|
||||
<< "/"
|
||||
<< target.GetPDBName(configName) << "\"\n";
|
||||
}
|
||||
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
|
||||
tool = "VCCustomBuildTool";
|
||||
if(this->FortranProject)
|
||||
|
|
|
@ -569,11 +569,9 @@ cmNinjaTargetGenerator
|
|||
EnsureParentDirectoryExists(objectFileName);
|
||||
|
||||
std::string objectDir = cmSystemTools::GetFilenamePath(objectFileName);
|
||||
objectDir = this->GetLocalGenerator()->Convert(objectDir.c_str(),
|
||||
cmLocalGenerator::START_OUTPUT,
|
||||
cmLocalGenerator::SHELL);
|
||||
vars["OBJECT_DIR"] = objectDir;
|
||||
|
||||
vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||
ConvertToNinjaPath(objectDir.c_str()).c_str(),
|
||||
cmLocalGenerator::SHELL);
|
||||
|
||||
this->SetMsvcTargetPdbVariable(vars);
|
||||
|
||||
|
|
|
@ -886,9 +886,9 @@ void cmTarget::DefineProperties(cmake *cm)
|
|||
|
||||
cm->DefineProperty
|
||||
("PDB_NAME", cmProperty::TARGET,
|
||||
"Output name for MS debug symbols .pdb file.",
|
||||
"Output name for MS debug symbols .pdb file from linker.",
|
||||
"Set the base name for debug symbols file created for an "
|
||||
"executable or library target. "
|
||||
"executable or shared library target. "
|
||||
"If not set, the logical target name is used by default. "
|
||||
"\n"
|
||||
"This property is not implemented by the Visual Studio 6 generator.");
|
||||
|
@ -1397,9 +1397,9 @@ void cmTarget::DefineProperties(cmake *cm)
|
|||
|
||||
cm->DefineProperty
|
||||
("PDB_OUTPUT_DIRECTORY", cmProperty::TARGET,
|
||||
"Output directory for MS debug symbols .pdb files.",
|
||||
"Output directory for MS debug symbols .pdb file from linker.",
|
||||
"This property specifies the directory into which the MS debug symbols "
|
||||
"will be placed. "
|
||||
"will be placed by the linker. "
|
||||
"This property is initialized by the value of the variable "
|
||||
"CMAKE_PDB_OUTPUT_DIRECTORY if it is set when a target is created."
|
||||
"\n"
|
||||
|
|
|
@ -1264,14 +1264,6 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
|
|||
*this->BuildFileStream << configName
|
||||
<< "</AssemblerListingLocation>\n";
|
||||
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
|
||||
if(this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
|
||||
{
|
||||
this->WriteString("<ProgramDataBaseFileName>", 3);
|
||||
*this->BuildFileStream << this->Target->GetPDBDirectory(configName.c_str())
|
||||
<< "/"
|
||||
<< this->Target->GetPDBName(configName.c_str())
|
||||
<< "</ProgramDataBaseFileName>\n";
|
||||
}
|
||||
this->WriteString("</ClCompile>\n", 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,9 @@ set_target_properties(mylibB PROPERTIES
|
|||
PDB_NAME "mylibB_Special"
|
||||
PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB"
|
||||
)
|
||||
list(APPEND my_targets mylibB)
|
||||
# TODO: The only .pdb available for a static library is that generated
|
||||
# by the compiler /Fd option which is not the same as the linker /pdb.
|
||||
# list(APPEND my_targets mylibB)
|
||||
|
||||
add_library(mylibC SHARED mylibC.c)
|
||||
set_target_properties(mylibC PROPERTIES
|
||||
|
@ -32,7 +34,8 @@ add_library(mylibD STATIC mylibD.c)
|
|||
set_target_properties(mylibD PROPERTIES
|
||||
PDB_NAME "mylibD_Special"
|
||||
)
|
||||
list(APPEND my_targets mylibD)
|
||||
# TODO: See comment for mylibB.
|
||||
# list(APPEND my_targets mylibD)
|
||||
|
||||
add_executable(myexe myexe.c)
|
||||
set_target_properties(myexe PROPERTIES
|
||||
|
@ -58,10 +61,6 @@ target_link_libraries(myexe2 mylibA mylibD)
|
|||
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6")
|
||||
return()
|
||||
endif()
|
||||
# PDB output not fully implemented for Intel
|
||||
if("${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(pdbs "")
|
||||
foreach(t ${my_targets})
|
||||
|
|
Loading…
Reference in New Issue