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/cmCoreTryCompile.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/cmCoreTryCompile.cxx')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index da04396..9c26f61 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -101,29 +101,23 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, this->SrcFileSignature = true; cmStateEnums::TargetType targetType = cmStateEnums::EXECUTABLE; - const char* tt = - this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_TARGET_TYPE"); - if (!isTryRun && tt && *tt) { - if (strcmp(tt, cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE)) == - 0) { + const std::string* tt = + this->Makefile->GetDef("CMAKE_TRY_COMPILE_TARGET_TYPE"); + if (!isTryRun && tt && !tt->empty()) { + if (*tt == cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE)) { targetType = cmStateEnums::EXECUTABLE; - } else if (strcmp(tt, - cmState::GetTargetTypeName( - cmStateEnums::STATIC_LIBRARY)) == 0) { + } else if (*tt == + cmState::GetTargetTypeName(cmStateEnums::STATIC_LIBRARY)) { targetType = cmStateEnums::STATIC_LIBRARY; } else { this->Makefile->IssueMessage( MessageType::FATAL_ERROR, - std::string("Invalid value '") + tt + - "' for " - "CMAKE_TRY_COMPILE_TARGET_TYPE. Only " - "'" + - cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE) + - "' and " - "'" + - cmState::GetTargetTypeName(cmStateEnums::STATIC_LIBRARY) + - "' " - "are allowed."); + cmStrCat("Invalid value '", *tt, + "' for CMAKE_TRY_COMPILE_TARGET_TYPE. Only '", + cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE), + "' and '", + cmState::GetTargetTypeName(cmStateEnums::STATIC_LIBRARY), + "' are allowed.")); return -1; } } @@ -296,12 +290,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, default: this->Makefile->IssueMessage( MessageType::FATAL_ERROR, - "Only libraries may be used as try_compile or try_run IMPORTED " - "LINK_LIBRARIES. Got " + - std::string(tgt->GetName()) + - " of " - "type " + - cmState::GetTargetTypeName(tgt->GetType()) + "."); + cmStrCat("Only libraries may be used as try_compile or try_run " + "IMPORTED LINK_LIBRARIES. Got ", + tgt->GetName(), " of type ", + cmState::GetTargetTypeName(tgt->GetType()), ".")); return -1; } if (tgt->IsImported()) { |