diff options
author | Brad King <brad.king@kitware.com> | 2020-03-25 13:25:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-03-25 13:25:26 (GMT) |
commit | 952fbd9ee5b40ddda1a9c4e25a2bc164d138a47a (patch) | |
tree | bb4618b61b23831e796a94b90f00148768cb158c /Source/cmState.cxx | |
parent | d13d5c11cf8b5878c5e63b067e73a2175f01d93f (diff) | |
parent | ef408dd232812c938d18dadb6e2440050a5db91b (diff) | |
download | CMake-952fbd9ee5b40ddda1a9c4e25a2bc164d138a47a.zip CMake-952fbd9ee5b40ddda1a9c4e25a2bc164d138a47a.tar.gz CMake-952fbd9ee5b40ddda1a9c4e25a2bc164d138a47a.tar.bz2 |
Merge topic 'cmprop-state'
ef408dd232 cmState::GetTargetTypeName: return type is *cmProp
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4505
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 b1fa772..6d95c7a 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 = { |