summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-20 17:19:26 (GMT)
committerBrad King <brad.king@kitware.com>2020-08-07 12:46:32 (GMT)
commit439191313363caea225a508634495c50d4cc60dd (patch)
treeeb1156c1fbf93b4a9ea23ec812ba49ef7a195846 /Source/cmLocalVisualStudio7Generator.cxx
parentafb998704e67d3d3ce5b24c112cb06e770fca78d (diff)
downloadCMake-439191313363caea225a508634495c50d4cc60dd.zip
CMake-439191313363caea225a508634495c50d4cc60dd.tar.gz
CMake-439191313363caea225a508634495c50d4cc60dd.tar.bz2
Add INTERFACE libraries to generated buildsystem if they have SOURCES
INTERFACE libraries were created with the intention of collecting usage requirements for use by other targets via `target_link_libraries`. Therefore they were not allowed to have SOURCES and were not included in the generated buildsystem. In practice, this has become limiting: * Header-only libraries do have sources, they just do not compile. Developers should be able to edit those sources (the header files) in their IDE. * Header-only libraries may need to generate some of their header files via custom commands. Some projects work around these limitations by pairing each interface library with an `add_custom_target` that makes the header files and custom commands appear in the generated buildsystem and in IDEs. Lift such limitations by allowing INTERFACE libraries to have SOURCES. For those with sources, add a corresponding build target to the generated buildsystem. Fixes: #19145
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index fec6a9d..50ffe8d 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -629,9 +629,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
break;
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
+ case cmStateEnums::INTERFACE_LIBRARY:
configType = "10";
CM_FALLTHROUGH;
- default:
+ case cmStateEnums::UNKNOWN_LIBRARY:
targetBuilds = false;
break;
}
@@ -1638,7 +1639,8 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
std::string source = sf->GetFullPath();
if (source != libName || target->GetType() == cmStateEnums::UTILITY ||
- target->GetType() == cmStateEnums::GLOBAL_TARGET) {
+ target->GetType() == cmStateEnums::GLOBAL_TARGET ||
+ target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Look up the source kind and configs.
std::map<cmSourceFile const*, size_t>::const_iterator map_it =
sources.Index.find(sf);
@@ -1937,6 +1939,7 @@ void cmLocalVisualStudio7Generator::WriteProjectStartFortran(
const char* keyword = p ? p->c_str() : "Console Application";
const char* projectType = 0;
switch (target->GetType()) {
+ case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
projectType = "typeStaticLibrary";
if (keyword) {
@@ -1958,7 +1961,8 @@ void cmLocalVisualStudio7Generator::WriteProjectStartFortran(
break;
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
- default:
+ case cmStateEnums::INTERFACE_LIBRARY:
+ case cmStateEnums::UNKNOWN_LIBRARY:
break;
}
if (projectType) {