| 1941 | } |
| 1942 | |
| 1943 | bool HandleExportAndroidMKMode(std::vector<std::string> const& args, |
| 1944 | cmExecutionStatus& status) |
| 1945 | { |
| 1946 | #ifndef CMAKE_BOOTSTRAP |
| 1947 | Helper helper(status); |
| 1948 | |
| 1949 | // This is the EXPORT mode. |
| 1950 | cmInstallCommandArguments ica(helper.DefaultComponentName, *helper.Makefile); |
| 1951 | |
| 1952 | std::string exp; |
| 1953 | std::string name_space; |
| 1954 | bool exportOld = false; |
| 1955 | std::string filename; |
| 1956 | |
| 1957 | ica.Bind("EXPORT_ANDROID_MK"_s, exp); |
| 1958 | ica.Bind("NAMESPACE"_s, name_space); |
| 1959 | ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld); |
| 1960 | ica.Bind("FILE"_s, filename); |
| 1961 | |
| 1962 | std::vector<std::string> unknownArgs; |
| 1963 | ica.Parse(args, &unknownArgs); |
| 1964 | |
| 1965 | if (!unknownArgs.empty()) { |
| 1966 | // Unknown argument. |
| 1967 | status.SetError( |
| 1968 | cmStrCat(args[0], " given unknown argument \"", unknownArgs[0], "\".")); |
| 1969 | return false; |
| 1970 | } |
| 1971 | |
| 1972 | if (!ica.Finalize()) { |
| 1973 | return false; |
| 1974 | } |
| 1975 | |
| 1976 | // Make sure there is a destination. |
| 1977 | if (ica.GetDestination().empty()) { |
| 1978 | // A destination is required. |
| 1979 | status.SetError(cmStrCat(args[0], " given no DESTINATION!")); |
| 1980 | return false; |
| 1981 | } |
| 1982 | |
| 1983 | // Check the file name. |
| 1984 | std::string fname = filename; |
| 1985 | if (fname.find_first_of(":/\\") != std::string::npos) { |
| 1986 | status.SetError(cmStrCat(args[0], " given invalid export file name \"", |
| 1987 | fname, |
| 1988 | "\". The FILE argument may not contain a path. " |
| 1989 | "Specify the path in the DESTINATION argument.")); |
| 1990 | return false; |
| 1991 | } |
| 1992 | |
| 1993 | // Check the file extension. |
| 1994 | if (!fname.empty() && !cmHasSuffix(fname, ".mk"_s)) { |
| 1995 | status.SetError(cmStrCat( |
| 1996 | args[0], " given invalid export file name \"", fname, |
| 1997 | R"(". The FILE argument must specify a name ending in ".mk".)")); |
| 1998 | return false; |
| 1999 | } |
| 2000 | if (fname.find_first_of(":/\\") != std::string::npos) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…