diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-19 13:00:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-19 12:55:03 (GMT) |
commit | ef408dd232812c938d18dadb6e2440050a5db91b (patch) | |
tree | 7263ccd2fe0425ba495cfa893a787c70e5fba82e /Source/cmState.cxx | |
parent | 60db3af147e03e6073ecd6c5729d627d4af66a67 (diff) | |
download | CMake-ef408dd232812c938d18dadb6e2440050a5db91b.zip CMake-ef408dd232812c938d18dadb6e2440050a5db91b.tar.gz CMake-ef408dd232812c938d18dadb6e2440050a5db91b.tar.bz2 |
cmState::GetTargetTypeName: return type is *cmProp
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index bc08223..298608c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -34,30 +34,44 @@ cmState::cmState() cmState::~cmState() = default; -const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType) -{ +const std::string& cmState::GetTargetTypeName( + cmStateEnums::TargetType targetType) +{ +#define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP + MAKE_STATIC_PROP(STATIC_LIBRARY); + MAKE_STATIC_PROP(MODULE_LIBRARY); + MAKE_STATIC_PROP(SHARED_LIBRARY); + MAKE_STATIC_PROP(OBJECT_LIBRARY); + MAKE_STATIC_PROP(EXECUTABLE); + MAKE_STATIC_PROP(UTILITY); + MAKE_STATIC_PROP(GLOBAL_TARGET); + MAKE_STATIC_PROP(INTERFACE_LIBRARY); + MAKE_STATIC_PROP(UNKNOWN_LIBRARY); + static const std::string propEmpty; +#undef MAKE_STATIC_PROP + switch (targetType) { case cmStateEnums::STATIC_LIBRARY: - return "STATIC_LIBRARY"; + return propSTATIC_LIBRARY; case cmStateEnums::MODULE_LIBRARY: - return "MODULE_LIBRARY"; + return propMODULE_LIBRARY; case cmStateEnums::SHARED_LIBRARY: - return "SHARED_LIBRARY"; + return propSHARED_LIBRARY; case cmStateEnums::OBJECT_LIBRARY: - return "OBJECT_LIBRARY"; + return propOBJECT_LIBRARY; case cmStateEnums::EXECUTABLE: - return "EXECUTABLE"; + return propEXECUTABLE; case cmStateEnums::UTILITY: - return "UTILITY"; + return propUTILITY; case cmStateEnums::GLOBAL_TARGET: - return "GLOBAL_TARGET"; + return propGLOBAL_TARGET; case cmStateEnums::INTERFACE_LIBRARY: - return "INTERFACE_LIBRARY"; + return propINTERFACE_LIBRARY; case cmStateEnums::UNKNOWN_LIBRARY: - return "UNKNOWN_LIBRARY"; + return propUNKNOWN_LIBRARY; } assert(false && "Unexpected target type"); - return nullptr; + return propEmpty; } static const std::array<std::string, 7> cmCacheEntryTypes = { |