From e47283c98954f7e586f281132eb0a1be246d627c Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 29 Aug 2019 11:04:16 -0700 Subject: [PATCH] build: place executable content into the root of the build Adjust the output location of the generated executable content to the root of the build tree. This is needed primarily on Windows where there is no concept of a RPATH, and the current directory is scanned for the dependent libraries. --- CMakeLists.txt | 6 ++++++ src/CMakeLists.txt | 1 + 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab5d2abde..0377b0b39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_C_VISIBILITY_PRESET hidden) +# NOTE(compnerd) this is a horrible workaround for Windows to ensure that the +# tests can run as there is no rpath equivalent and `PATH` is used to lookup the +# libraries. +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9c4ae4c9c..2809c11c9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,6 +124,7 @@ if(ENABLE_SWIFT) module-maps DispatchStubs LINK_FLAGS + -L $ -lDispatchStubs -L $ -lBlocksRuntime