|  | @@ -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()) {
 |