diff options
author | Mikko Sivulainen <mikko.sivulainen@supercell.com> | 2022-09-14 11:30:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-09-15 14:27:23 (GMT) |
commit | d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0 (patch) | |
tree | 18de254315c7cabb6ef99430505d3089fbb1d8dd /Tests | |
parent | c3e68020d61ae306261b4f953947483a960edf32 (diff) | |
download | CMake-d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0.zip CMake-d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0.tar.gz CMake-d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0.tar.bz2 |
Xcode: Do not append per-config suffixes to library search paths
Add policy `CMP0142` to remove the automatic addition of the
`$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)` suffix in a compatible way.
Fixes: #21757
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/SearchPaths-check.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/SearchPaths.cmake | 10 |
3 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 97c3394..0d8e4c9 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -36,6 +36,7 @@ \* CMP0113 \* CMP0119 \* CMP0131 + \* CMP0142 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake index 71b7d8f..bec8790 100644 --- a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake +++ b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake @@ -12,6 +12,8 @@ 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_target_cmp0142old_LIBRARY_SEARCH_PATHS 0) +set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 0) set(found_inherited_LIBRARY_SEARCH_PATHS 0) file(STRINGS "${xcProjectFile}" lines) foreach(line IN LISTS lines) @@ -42,6 +44,12 @@ foreach(line IN LISTS lines) 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 = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD(\\")?","\$\(inherited\)"\);]]) + set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 1) + endif() + if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142NEW(\\")?","\$\(inherited\)"\);]]) + set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 1) + endif() if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("\$\(inherited\)"\);]]) set(found_inherited_LIBRARY_SEARCH_PATHS 1) endif() @@ -68,6 +76,12 @@ 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(NOT found_target_cmp0142old_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142old' in\n ${xcProjectFile}\n") +endif() +if(NOT found_target_cmp0142new_LIBRARY_SEARCH_PATHS) + string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142new' 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() diff --git a/Tests/RunCMake/XcodeProject/SearchPaths.cmake b/Tests/RunCMake/XcodeProject/SearchPaths.cmake index ef97709..b469772 100644 --- a/Tests/RunCMake/XcodeProject/SearchPaths.cmake +++ b/Tests/RunCMake/XcodeProject/SearchPaths.cmake @@ -3,6 +3,8 @@ enable_language(C) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathInc/TargetInc.framework") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW") set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") set(CMAKE_XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath") @@ -19,3 +21,11 @@ target_include_directories(include PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSe add_executable(library main.c) target_link_libraries(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework") target_link_directories(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib") + +cmake_policy(SET CMP0142 OLD) +add_executable(cmp0142old main.c) +target_link_directories(cmp0142old PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD") + +cmake_policy(SET CMP0142 NEW) +add_executable(cmp0142new main.c) +target_link_directories(cmp0142new PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW") |