Skip to content

Commit bbfda2e

Browse files
committed
[CMake] Force the output dir of the fake-for-testing libBlocksRuntime
LLVM was setting config-specific paths that overrode the ones provided here. We don't actually care about configuration for this dummy, testing-only library, so just force it back to a flat layout based on target platform. No functionality change for Ninja users.
1 parent b08a01f commit bbfda2e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,30 @@ _Block_release(void) { }\n")
219219
NOSWIFTRT
220220
ARCHITECTURE ${ARCH}
221221
SDK ${SDK}
222+
TARGET_LIBRARY
222223
INSTALL_IN_COMPONENT dev
223224
${test_bin_dir}/BlocksRuntime.c)
224225
set_target_properties(BlocksRuntimeStub${VARIANT_SUFFIX} PROPERTIES
225226
ARCHIVE_OUTPUT_DIRECTORY ${test_bin_dir}
226227
LIBRARY_OUTPUT_DIRECTORY ${test_bin_dir}
227228
RUNTIME_OUTPUT_DIRECTORY ${test_bin_dir}
228229
OUTPUT_NAME BlocksRuntime)
230+
231+
# Hack around LLVM's "helpful" config-specific output directories (they're
232+
# not needed).
233+
#
234+
# This is only relevant for build systems that support multiple
235+
# configurations, like Xcode.
236+
if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
237+
foreach(config ${CMAKE_CONFIGURATION_TYPES})
238+
string(TOUPPER "${config}" config)
239+
set_target_properties(BlocksRuntimeStub${VARIANT_SUFFIX} PROPERTIES
240+
ARCHIVE_OUTPUT_DIRECTORY_${config} "${test_bin_dir}"
241+
LIBRARY_OUTPUT_DIRECTORY_${config} "${test_bin_dir}"
242+
RUNTIME_OUTPUT_DIRECTORY_${config} "${test_bin_dir}")
243+
endforeach()
244+
endif()
245+
229246
list(APPEND test_dependencies BlocksRuntimeStub${VARIANT_SUFFIX})
230247

231248
if(SWIFT_BUILD_STDLIB AND SWIFT_INCLUDE_TESTS)

0 commit comments

Comments
 (0)