mirror of
https://github.com/reactos/CMake.git
synced 2025-03-05 10:27:06 +00:00
Add generator expression support to PDB_OUTPUT_DIRECTORY target property
Fixes: #16365
This commit is contained in:
parent
acb9710162
commit
79ca546ed2
Help
prop_tgt
release/dev
Source
Tests/PDBDirectoryAndName
@ -5,8 +5,14 @@ Output directory for the MS debug symbols ``.pdb`` file
|
|||||||
generated by the linker for an executable or shared library target.
|
generated by the linker for an executable or shared library target.
|
||||||
|
|
||||||
This property specifies the directory into which the MS debug symbols
|
This property specifies the directory into which the MS debug symbols
|
||||||
will be placed by the linker. This property is initialized by the
|
will be placed by the linker. The property value may use
|
||||||
value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
|
Multi-configuration generators append a per-configuration
|
||||||
|
subdirectory to the specified directory unless a generator expression
|
||||||
|
is used.
|
||||||
|
|
||||||
|
This property is initialized by the value of the
|
||||||
|
:variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is
|
||||||
set when a target is created.
|
set when a target is created.
|
||||||
|
|
||||||
.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`
|
.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`
|
||||||
|
@ -11,5 +11,8 @@ property is initialized by the value of the
|
|||||||
:variable:`CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG>` variable if it is
|
:variable:`CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG>` variable if it is
|
||||||
set when a target is created.
|
set when a target is created.
|
||||||
|
|
||||||
|
Contents of ``PDB_OUTPUT_DIRECTORY_<CONFIG>`` may use
|
||||||
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
|
|
||||||
.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>`
|
.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>`
|
||||||
.. include:: PDB_NOTE.txt
|
.. include:: PDB_NOTE.txt
|
||||||
|
5
Help/release/dev/PDBDirectoryGenExpression.rst
Normal file
5
Help/release/dev/PDBDirectoryGenExpression.rst
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
PDBDirectoryGenExpression
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
* The :prop_tgt:`PDB_OUTPUT_DIRECTORY` property learned to support
|
||||||
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
@ -4612,13 +4612,24 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
|
|||||||
// Select an output directory.
|
// Select an output directory.
|
||||||
if (const char* config_outdir = this->GetProperty(configProp)) {
|
if (const char* config_outdir = this->GetProperty(configProp)) {
|
||||||
// Use the user-specified per-configuration output directory.
|
// Use the user-specified per-configuration output directory.
|
||||||
out = config_outdir;
|
cmGeneratorExpression ge;
|
||||||
|
std::unique_ptr<cmCompiledGeneratorExpression> cge =
|
||||||
|
ge.Parse(config_outdir);
|
||||||
|
out = cge->Evaluate(this->LocalGenerator, config);
|
||||||
|
|
||||||
// Skip per-configuration subdirectory.
|
// Skip per-configuration subdirectory.
|
||||||
conf.clear();
|
conf.clear();
|
||||||
} else if (const char* outdir = this->GetProperty(propertyName)) {
|
} else if (const char* outdir = this->GetProperty(propertyName)) {
|
||||||
// Use the user-specified output directory.
|
// Use the user-specified output directory.
|
||||||
out = outdir;
|
cmGeneratorExpression ge;
|
||||||
|
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
|
||||||
|
out = cge->Evaluate(this->LocalGenerator, config);
|
||||||
|
|
||||||
|
// Skip per-configuration subdirectory if the value contained a
|
||||||
|
// generator expression.
|
||||||
|
if (out != outdir) {
|
||||||
|
conf.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (out.empty()) {
|
if (out.empty()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -19,7 +19,7 @@ set(my_targets "")
|
|||||||
add_library(mylibA SHARED mylibA.c)
|
add_library(mylibA SHARED mylibA.c)
|
||||||
set_target_properties(mylibA PROPERTIES
|
set_target_properties(mylibA PROPERTIES
|
||||||
PDB_NAME "mylibA_Special"
|
PDB_NAME "mylibA_Special"
|
||||||
PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibA_PDB"
|
PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibA_PDB/$<CONFIG>"
|
||||||
)
|
)
|
||||||
list(APPEND my_targets mylibA)
|
list(APPEND my_targets mylibA)
|
||||||
|
|
||||||
@ -87,7 +87,13 @@ foreach(t ${my_targets})
|
|||||||
if(NOT pdb_dir)
|
if(NOT pdb_dir)
|
||||||
set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR})
|
set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
list(APPEND pdbs ${pdb_dir}/${CMAKE_CFG_INTDIR}/${pdb_name}.pdb)
|
if (pdb_dir MATCHES "\\$<.*>")
|
||||||
|
# Skip per-configuration subdirectory if the value contained
|
||||||
|
# a generator expression.
|
||||||
|
list(APPEND pdbs ${pdb_dir}/${pdb_name}.pdb)
|
||||||
|
else()
|
||||||
|
list(APPEND pdbs ${pdb_dir}/${CMAKE_CFG_INTDIR}/${pdb_name}.pdb)
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
add_custom_target(check_pdbs ALL VERBATIM
|
add_custom_target(check_pdbs ALL VERBATIM
|
||||||
COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIGURATION> "-Dpdbs=${pdbs}"
|
COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIGURATION> "-Dpdbs=${pdbs}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user