| 624 | } |
| 625 | |
| 626 | bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) |
| 627 | { |
| 628 | if (args.empty()) { |
| 629 | this->SetError("called with incorrect number of arguments"); |
| 630 | return false; |
| 631 | } |
| 632 | |
| 633 | if (this->Makefile->GetStateSnapshot().GetUnwindState() == |
| 634 | cmStateEnums::UNWINDING) { |
| 635 | this->SetError("called while already in an UNWIND state"); |
| 636 | return false; |
| 637 | } |
| 638 | |
| 639 | // Lookup required version of CMake. |
| 640 | if (cmValue const rv = |
| 641 | this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) { |
| 642 | unsigned int v[3] = { 0, 0, 0 }; |
| 643 | std::sscanf(rv->c_str(), "%u.%u.%u", &v[0], &v[1], &v[2]); |
| 644 | this->RequiredCMakeVersion = CMake_VERSION_ENCODE(v[0], v[1], v[2]); |
| 645 | } |
| 646 | |
| 647 | // Lookup target architecture, if any. |
| 648 | if (cmValue const arch = |
| 649 | this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE")) { |
| 650 | this->LibraryArchitecture = *arch; |
| 651 | } |
| 652 | |
| 653 | // Lookup whether lib32 paths should be used. |
| 654 | if (this->Makefile->PlatformIs32Bit() && |
| 655 | this->Makefile->GetState()->GetGlobalPropertyAsBool( |
| 656 | "FIND_LIBRARY_USE_LIB32_PATHS")) { |
| 657 | this->UseLib32Paths = true; |
| 658 | } |
| 659 | |
| 660 | // Lookup whether lib64 paths should be used. |
| 661 | if (this->Makefile->PlatformIs64Bit() && |
| 662 | this->Makefile->GetState()->GetGlobalPropertyAsBool( |
| 663 | "FIND_LIBRARY_USE_LIB64_PATHS")) { |
| 664 | this->UseLib64Paths = true; |
| 665 | } |
| 666 | |
| 667 | // Lookup whether libx32 paths should be used. |
| 668 | if (this->Makefile->PlatformIsx32() && |
| 669 | this->Makefile->GetState()->GetGlobalPropertyAsBool( |
| 670 | "FIND_LIBRARY_USE_LIBX32_PATHS")) { |
| 671 | this->UseLibx32Paths = true; |
| 672 | } |
| 673 | |
| 674 | // Check if User Package Registry should be disabled |
| 675 | // The `CMAKE_FIND_USE_PACKAGE_REGISTRY` has |
| 676 | // priority over the deprecated CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY |
| 677 | if (cmValue const def = |
| 678 | this->Makefile->GetDefinition("CMAKE_FIND_USE_PACKAGE_REGISTRY")) { |
| 679 | this->NoUserRegistry = !def.IsOn(); |
| 680 | } else if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) { |
| 681 | this->NoUserRegistry = true; |
| 682 | } |
| 683 |
no test coverage detected