Merge topic 'minor-cleanups'
b8dc7fa
Genex: Disallow LINKER_LANGUAGE only when used on a static library.c8a10ba
cmTarget: Fix iface libraries and languages for static libraries.f94bdb3
cmTarget: Remove duplicates when printing traces of tll signaturesff3d5fa
Export: Fix typo of LINK_INTERFACE_LIBRARIES.79a7a81
Docs: Document variables for default visibility values.6f6391b
Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs.d8cb47f
Docs: Trim trailing whitespace in generated doc.f10e648
Docs: Document existing target property debugging options.4f4d69f
Qt4Macros: Simplify some variable population.a413a40
Qt4Macros: Remove undefined varible use.b60a29e
Qt4Macros: Remove unneeded generate CONDITION.e454cba
Docs: Document file(GENERATE) CONDITION as optional.
This commit is contained in:
commit
3dace78c2c
|
@ -113,19 +113,16 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target)
|
||||||
set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
|
set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
|
||||||
string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
|
string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
|
||||||
|
|
||||||
set(targetincludes)
|
|
||||||
set(targetdefines)
|
|
||||||
if(moc_target)
|
if(moc_target)
|
||||||
list(APPEND targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>")
|
set(targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>")
|
||||||
list(APPEND targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>")
|
set(targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>")
|
||||||
|
|
||||||
set(targetincludes "$<$<BOOL:${targetincludes}>:-I$<JOIN:${targetincludes},\n-I>\n>")
|
set(targetincludes "$<$<BOOL:${targetincludes}>:-I$<JOIN:${targetincludes},\n-I>\n>")
|
||||||
set(targetdefines "$<$<BOOL:${targetdefines}>:-D$<JOIN:${targetdefines},\n-D>\n>")
|
set(targetdefines "$<$<BOOL:${targetdefines}>:-D$<JOIN:${targetdefines},\n-D>\n>")
|
||||||
|
|
||||||
file (GENERATE
|
file (GENERATE
|
||||||
OUTPUT ${_moc_parameters_file}
|
OUTPUT ${_moc_parameters_file}
|
||||||
CONTENT "${targetdefines}${targetincludes}${targetoptions}${_moc_parameters}\n"
|
CONTENT "${targetdefines}${targetincludes}${_moc_parameters}\n"
|
||||||
CONDITION 1
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(targetincludes)
|
set(targetincludes)
|
||||||
|
|
|
@ -963,9 +963,11 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
|
||||||
"Enables tracing output for target properties.",
|
"Enables tracing output for target properties.",
|
||||||
"This variable can be populated with a list of properties to generate "
|
"This variable can be populated with a list of properties to generate "
|
||||||
"debug output for when evaluating target properties. Currently it can "
|
"debug output for when evaluating target properties. Currently it can "
|
||||||
"only be used when evaluating the INCLUDE_DIRECTORIES target property. "
|
"only be used when evaluating the INCLUDE_DIRECTORIES, "
|
||||||
"In that case, it outputs a backtrace for each include directory in "
|
"COMPILE_DEFINITIONS and COMPILE_OPTIONS target properties. "
|
||||||
"the build. Default is unset.",false,"Variables That Change Behavior");
|
"In that case, it outputs a backtrace for each entry in the target "
|
||||||
|
"propertythe build. Default is unset.",
|
||||||
|
false,"Variables That Change Behavior");
|
||||||
|
|
||||||
// Variables defined by CMake that describe the system
|
// Variables defined by CMake that describe the system
|
||||||
|
|
||||||
|
@ -1518,6 +1520,22 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
|
||||||
"See that target property for additional information.",
|
"See that target property for additional information.",
|
||||||
false,
|
false,
|
||||||
"Variables that Control the Build");
|
"Variables that Control the Build");
|
||||||
|
cm->DefineProperty
|
||||||
|
("CMAKE_<LANG>_VISIBILITY_PRESET", cmProperty::VARIABLE,
|
||||||
|
"Default value for <LANG>_VISIBILITY_PRESET of targets.",
|
||||||
|
"This variable is used to initialize the "
|
||||||
|
"<LANG>_VISIBILITY_PRESET property on all the targets. "
|
||||||
|
"See that target property for additional information.",
|
||||||
|
false,
|
||||||
|
"Variables that Control the Build");
|
||||||
|
cm->DefineProperty
|
||||||
|
("CMAKE_VISIBILITY_INLINES_HIDDEN", cmProperty::VARIABLE,
|
||||||
|
"Default value for VISIBILITY_INLINES_HIDDEN of targets.",
|
||||||
|
"This variable is used to initialize the "
|
||||||
|
"VISIBILITY_INLINES_HIDDEN property on all the targets. "
|
||||||
|
"See that target property for additional information.",
|
||||||
|
false,
|
||||||
|
"Variables that Control the Build");
|
||||||
|
|
||||||
// Variables defined when the a language is enabled These variables will
|
// Variables defined when the a language is enabled These variables will
|
||||||
// also be defined whenever CMake has loaded its support for compiling (LANG)
|
// also be defined whenever CMake has loaded its support for compiling (LANG)
|
||||||
|
|
|
@ -641,7 +641,7 @@ cmExportFileGenerator
|
||||||
cmMakefile *mf = target->GetMakefile();
|
cmMakefile *mf = target->GetMakefile();
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
|
e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
|
||||||
"but also has old-style INTERFACE_LINK_LIBRARIES properties "
|
"but also has old-style LINK_INTERFACE_LIBRARIES properties "
|
||||||
"populated, but it was exported without the "
|
"populated, but it was exported without the "
|
||||||
"EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
|
"EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
|
||||||
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
|
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
" file(TIMESTAMP filename variable [<format string>] [UTC])\n"
|
" file(TIMESTAMP filename variable [<format string>] [UTC])\n"
|
||||||
" file(GENERATE OUTPUT output_file\n"
|
" file(GENERATE OUTPUT output_file\n"
|
||||||
" <INPUT input_file|CONTENT input_content>\n"
|
" <INPUT input_file|CONTENT input_content>\n"
|
||||||
" CONDITION expression)\n"
|
" [CONDITION expression])\n"
|
||||||
"WRITE will write a message into a file called 'filename'. It "
|
"WRITE will write a message into a file called 'filename'. It "
|
||||||
"overwrites the file if it already exists, and creates the file "
|
"overwrites the file if it already exists, and creates the file "
|
||||||
"if it does not exist. (If the file is a build input, use "
|
"if it does not exist. (If the file is a build input, use "
|
||||||
|
|
|
@ -790,11 +790,12 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
|
|
||||||
if (propertyName == "LINKER_LANGUAGE")
|
if (propertyName == "LINKER_LANGUAGE")
|
||||||
{
|
{
|
||||||
if (dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries())
|
if (target->LinkLanguagePropagatesToDependents() &&
|
||||||
|
dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries())
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
"LINKER_LANGUAGE target property can not be used while evaluating "
|
"LINKER_LANGUAGE target property can not be used while evaluating "
|
||||||
"link libraries");
|
"link libraries for a static library");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
const char *lang = target->GetLinkerLanguage(context->Config);
|
const char *lang = target->GetLinkerLanguage(context->Config);
|
||||||
|
|
|
@ -4081,7 +4081,7 @@ void cmMakefile::DefineProperties(cmake *cm)
|
||||||
"List of options to pass to the compiler.",
|
"List of options to pass to the compiler.",
|
||||||
"This property specifies the list of directories given "
|
"This property specifies the list of directories given "
|
||||||
"so far for this property. "
|
"so far for this property. "
|
||||||
"This property exists on directories and targets. "
|
"This property exists on directories and targets."
|
||||||
"\n"
|
"\n"
|
||||||
"The target property values are used by the generators to set "
|
"The target property values are used by the generators to set "
|
||||||
"the options for the compiler.\n"
|
"the options for the compiler.\n"
|
||||||
|
|
|
@ -304,7 +304,7 @@ void cmTarget::DefineProperties(cmake *cm)
|
||||||
"List of options to pass to the compiler.",
|
"List of options to pass to the compiler.",
|
||||||
"This property specifies the list of options specified "
|
"This property specifies the list of options specified "
|
||||||
"so far for this property. "
|
"so far for this property. "
|
||||||
"This property exists on directories and targets. "
|
"This property exists on directories and targets."
|
||||||
"\n"
|
"\n"
|
||||||
"The target property values are used by the generators to set "
|
"The target property values are used by the generators to set "
|
||||||
"the options for the compiler.\n"
|
"the options for the compiler.\n"
|
||||||
|
@ -1001,22 +1001,13 @@ void cmTarget::DefineProperties(cmake *cm)
|
||||||
"(such as \"lib\") on a library name.");
|
"(such as \"lib\") on a library name.");
|
||||||
|
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("C_VISIBILITY_PRESET", cmProperty::TARGET,
|
("<LANG>_VISIBILITY_PRESET", cmProperty::TARGET,
|
||||||
"Value for symbol visibility compile flags",
|
"Value for symbol visibility compile flags",
|
||||||
"The C_VISIBILITY_PRESET property determines the value passed used in "
|
"The <LANG>_VISIBILITY_PRESET property determines the value passed in "
|
||||||
"a visibility related compile option, such as -fvisibility=. This "
|
"a visibility related compile option, such as -fvisibility= for <LANG>. "
|
||||||
"property only has an affect for libraries and executables with "
|
"This property only has an affect for libraries and executables with "
|
||||||
"exports. This property is initialized by the value of the variable "
|
"exports. This property is initialized by the value of the variable "
|
||||||
"CMAKE_C_VISIBILITY_PRESET if it is set when a target is created.");
|
"CMAKE_<LANG>_VISIBILITY_PRESET if it is set when a target is created.");
|
||||||
|
|
||||||
cm->DefineProperty
|
|
||||||
("CXX_VISIBILITY_PRESET", cmProperty::TARGET,
|
|
||||||
"Value for symbol visibility compile flags",
|
|
||||||
"The CXX_VISIBILITY_PRESET property determines the value passed used in "
|
|
||||||
"a visibility related compile option, such as -fvisibility=. This "
|
|
||||||
"property only has an affect for libraries and executables with "
|
|
||||||
"exports. This property is initialized by the value of the variable "
|
|
||||||
"CMAKE_CXX_VISIBILITY_PRESET if it is set when a target is created.");
|
|
||||||
|
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("VISIBILITY_INLINES_HIDDEN", cmProperty::TARGET,
|
("VISIBILITY_INLINES_HIDDEN", cmProperty::TARGET,
|
||||||
|
@ -2530,6 +2521,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
|
||||||
= (sig == cmTarget::KeywordTLLSignature ? "keyword"
|
= (sig == cmTarget::KeywordTLLSignature ? "keyword"
|
||||||
: "plain");
|
: "plain");
|
||||||
s << "The uses of the " << sigString << " signature are here:\n";
|
s << "The uses of the " << sigString << " signature are here:\n";
|
||||||
|
std::set<cmStdString> emitted;
|
||||||
for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin();
|
for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin();
|
||||||
it != sigs.end(); ++it)
|
it != sigs.end(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -2537,7 +2529,12 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
|
||||||
if(i != it->end())
|
if(i != it->end())
|
||||||
{
|
{
|
||||||
cmListFileContext const& lfc = *i;
|
cmListFileContext const& lfc = *i;
|
||||||
s << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
|
cmOStringStream line;
|
||||||
|
line << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
|
||||||
|
if (emitted.insert(line.str()).second)
|
||||||
|
{
|
||||||
|
s << line.str();
|
||||||
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6244,7 +6241,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the link languages.
|
// Get the link languages.
|
||||||
if(this->GetType() == cmTarget::STATIC_LIBRARY)
|
if(this->LinkLanguagePropagatesToDependents())
|
||||||
{
|
{
|
||||||
std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES";
|
std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES";
|
||||||
linkProp += suffix;
|
linkProp += suffix;
|
||||||
|
@ -6470,6 +6467,15 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iface.Libraries = impl->Libraries;
|
||||||
|
if(this->LinkLanguagePropagatesToDependents())
|
||||||
|
{
|
||||||
|
// Targets using this archive need its language runtime libraries.
|
||||||
|
iface.Languages = impl->Languages;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6498,7 +6504,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
|
||||||
headTarget,
|
headTarget,
|
||||||
this, &dagChecker), iface.Libraries);
|
this, &dagChecker), iface.Libraries);
|
||||||
|
|
||||||
if(this->GetType() == cmTarget::SHARED_LIBRARY)
|
if(this->GetType() == cmTarget::SHARED_LIBRARY
|
||||||
|
|| this->GetType() == cmTarget::STATIC_LIBRARY)
|
||||||
{
|
{
|
||||||
// Shared libraries may have runtime implementation dependencies
|
// Shared libraries may have runtime implementation dependencies
|
||||||
// on other shared libraries that are not in the interface.
|
// on other shared libraries that are not in the interface.
|
||||||
|
@ -6532,6 +6539,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(this->LinkLanguagePropagatesToDependents())
|
||||||
|
{
|
||||||
|
// Targets using this archive need its language runtime libraries.
|
||||||
|
iface.Languages = impl->Languages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
|
else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
|
||||||
|
@ -6546,7 +6558,7 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
|
||||||
iface.ImplementationIsInterface = true;
|
iface.ImplementationIsInterface = true;
|
||||||
iface.Libraries = impl->Libraries;
|
iface.Libraries = impl->Libraries;
|
||||||
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
|
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
|
||||||
if(this->GetType() == cmTarget::STATIC_LIBRARY)
|
if(this->LinkLanguagePropagatesToDependents())
|
||||||
{
|
{
|
||||||
// Targets using this archive need its language runtime libraries.
|
// Targets using this archive need its language runtime libraries.
|
||||||
iface.Languages = impl->Languages;
|
iface.Languages = impl->Languages;
|
||||||
|
|
|
@ -549,6 +549,9 @@ public:
|
||||||
|
|
||||||
void FinalizeSystemIncludeDirectories();
|
void FinalizeSystemIncludeDirectories();
|
||||||
|
|
||||||
|
bool LinkLanguagePropagatesToDependents() const
|
||||||
|
{ return this->TargetTypeValue == STATIC_LIBRARY; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The set of include directories that are marked as system include
|
// The set of include directories that are marked as system include
|
||||||
// directories.
|
// directories.
|
||||||
|
|
|
@ -16,3 +16,12 @@ assert_property(cmp0022ifacelib INTERFACE_LINK_LIBRARIES "")
|
||||||
|
|
||||||
add_executable(cmp0022exe cmp0022exe.cpp)
|
add_executable(cmp0022exe cmp0022exe.cpp)
|
||||||
target_link_libraries(cmp0022exe cmp0022lib)
|
target_link_libraries(cmp0022exe cmp0022lib)
|
||||||
|
|
||||||
|
add_library(staticlib1 STATIC staticlib1.cpp)
|
||||||
|
generate_export_header(staticlib1)
|
||||||
|
add_library(staticlib2 STATIC staticlib2.cpp)
|
||||||
|
generate_export_header(staticlib2)
|
||||||
|
target_link_libraries(staticlib1 LINK_PUBLIC staticlib2)
|
||||||
|
|
||||||
|
add_executable(staticlib_exe staticlib_exe.cpp)
|
||||||
|
target_link_libraries(staticlib_exe staticlib1)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
int staticlib1() { return 0; }
|
|
@ -0,0 +1,4 @@
|
||||||
|
#ifdef _WIN32
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
int staticlib1();
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
int staticlib2() { return 0; }
|
|
@ -0,0 +1,4 @@
|
||||||
|
#ifdef _WIN32
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
int staticlib2();
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
#include "staticlib1.h"
|
||||||
|
#include "staticlib2.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return staticlib1() + staticlib2();
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
CMake Error at CMP0022-export.cmake:11 \(export\):
|
CMake Error at CMP0022-export.cmake:11 \(export\):
|
||||||
Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style
|
Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style
|
||||||
INTERFACE_LINK_LIBRARIES properties populated, but it was exported without
|
LINK_INTERFACE_LIBRARIES properties populated, but it was exported without
|
||||||
the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties
|
the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
CMake Error in CMakeLists.txt:
|
CMake Error in CMakeLists.txt:
|
||||||
Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style
|
Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style
|
||||||
INTERFACE_LINK_LIBRARIES properties populated, but it was exported without
|
LINK_INTERFACE_LIBRARIES properties populated, but it was exported without
|
||||||
the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties
|
the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
add_library(foo SHARED empty.cpp)
|
add_library(foo STATIC empty.cpp)
|
||||||
add_library(bar SHARED empty.cpp)
|
add_library(bar STATIC empty.cpp)
|
||||||
target_link_libraries(foo $<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,anything>:bar>)
|
target_link_libraries(foo $<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,anything>:bar>)
|
||||||
|
|
Loading…
Reference in New Issue