diff options
author | Brad King <brad.king@kitware.com> | 2020-12-17 16:53:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-22 13:56:26 (GMT) |
commit | 5115e8b2b669f09419f895a1375df285b675e9e7 (patch) | |
tree | 34bada11111fc504e212698df392816b8b71d3a7 /Tests/RunCMake/XcodeProject/SearchPaths-check.cmake | |
parent | 6b6230b23b290694aad4c05d7a32fd8241f93ca5 (diff) | |
download | CMake-5115e8b2b669f09419f895a1375df285b675e9e7.zip CMake-5115e8b2b669f09419f895a1375df285b675e9e7.tar.gz CMake-5115e8b2b669f09419f895a1375df285b675e9e7.tar.bz2 |
Xcode: Generalize inheritance of project-level search paths
Generalize the change from commit bffb17be3d (Xcode: Inherit target
library and framework search paths from project, 2020-11-04,
v3.19.0-rc3~4^2) to apply to framework and other kinds of search paths
added either for include directories or for linking.
Issue: #21617
Diffstat (limited to 'Tests/RunCMake/XcodeProject/SearchPaths-check.cmake')
-rw-r--r-- | Tests/RunCMake/XcodeProject/SearchPaths-check.cmake | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake new file mode 100644 index 0000000..71b7d8f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake @@ -0,0 +1,76 @@ +set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/SearchPaths.xcodeproj/project.pbxproj") +if(NOT EXISTS "${xcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.") + return() +endif() + +set(relevant_lines "") +set(found_project_FRAMEWORK_SEARCH_PATHS 0) +set(found_target_both_FRAMEWORK_SEARCH_PATHS 0) +set(found_target_include_FRAMEWORK_SEARCH_PATHS 0) +set(found_target_library_FRAMEWORK_SEARCH_PATHS 0) +set(found_inherited_FRAMEWORK_SEARCH_PATHS 0) +set(found_project_LIBRARY_SEARCH_PATHS 0) +set(found_target_library_LIBRARY_SEARCH_PATHS 0) +set(found_inherited_LIBRARY_SEARCH_PATHS 0) +file(STRINGS "${xcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES [[FRAMEWORK_SEARCH_PATHS]]) + string(APPEND relevant_lines " ${line}\n") + if(line MATCHES [[FRAMEWORK_SEARCH_PATHS = "[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/ProjectSearchPath";]]) + set(found_project_FRAMEWORK_SEARCH_PATHS 1) + endif() + if(line MATCHES [[FRAMEWORK_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathInc(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib(\\")?","\$\(inherited\)"\);]]) + set(found_target_both_FRAMEWORK_SEARCH_PATHS 1) + endif() + if(line MATCHES [[FRAMEWORK_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathInc(\\")?","\$\(inherited\)"\);]]) + set(found_target_include_FRAMEWORK_SEARCH_PATHS 1) + endif() + if(line MATCHES [[FRAMEWORK_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib(\\")?","\$\(inherited\)"\);]]) + set(found_target_library_FRAMEWORK_SEARCH_PATHS 1) + endif() + if(line MATCHES [[FRAMEWORK_SEARCH_PATHS = \("\$\(inherited\)"\);]]) + set(found_inherited_FRAMEWORK_SEARCH_PATHS 1) + endif() + endif() + + if(line MATCHES [[LIBRARY_SEARCH_PATHS]]) + string(APPEND relevant_lines " ${line}\n") + if(line MATCHES [[LIBRARY_SEARCH_PATHS = "[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/ProjectSearchPath";]]) + set(found_project_LIBRARY_SEARCH_PATHS 1) + endif() + if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib(\\")?","\$\(inherited\)"\);]]) + set(found_target_library_LIBRARY_SEARCH_PATHS 1) + endif() + if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("\$\(inherited\)"\);]]) + set(found_inherited_LIBRARY_SEARCH_PATHS 1) + endif() + endif() +endforeach() +if(NOT found_project_FRAMEWORK_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected FRAMEWORK_SEARCH_PATHS for project in\n ${xcProjectFile}\n") +endif() +if(NOT found_target_both_FRAMEWORK_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected FRAMEWORK_SEARCH_PATHS for target 'both' in\n ${xcProjectFile}\n") +endif() +if(NOT found_target_include_FRAMEWORK_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'include' in\n ${xcProjectFile}\n") +endif() +if(NOT found_target_library_FRAMEWORK_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'library' in\n ${xcProjectFile}\n") +endif() +if(found_inherited_FRAMEWORK_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Found unexpected LIBRARY_SEARCH_PATHS inherited-only value in\n ${xcProjectFile}\n") +endif() +if(NOT found_project_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for project in\n ${xcProjectFile}\n") +endif() +if(NOT found_target_library_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'library' in\n ${xcProjectFile}\n") +endif() +if(found_inherited_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Found unexpected LIBRARY_SEARCH_PATHS inherited-only value in\n ${xcProjectFile}\n") +endif() +if(RunCMake_TEST_FAILED) + string(APPEND RunCMake_TEST_FAILED "Relevant lines include\n${relevant_lines}") +endif() |