Commit 11c80b8e04feaa7b72cdbada92d5417dce7146dd

Ralf Habacker 2020-11-02T12:37:36

cmake: place all generated binaries into one place This is required for running test applications, because by default cmake places binaries into the associated subdir.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 17d3fc4..321cfd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,10 @@ project (dlfcn-win32 C)
 option(BUILD_SHARED_LIBS "shared/static libs" ON) 
 option(BUILD_TESTS "tests?" OFF)
 
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+
 add_subdirectory(src)
 
 if (BUILD_TESTS)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 64f85f7..25e9eea 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -9,4 +9,4 @@ add_library(testdll3 SHARED testdll3.c)
 set_target_properties(testdll3 PROPERTIES PREFIX "")
 add_executable(t_dlfcn test.c)
 target_link_libraries(t_dlfcn dl)
-add_test (NAME t_dlfcn COMMAND t_dlfcn)
+add_test(NAME t_dlfcn COMMAND $<TARGET_FILE:t_dlfcn> WORKING_DIRECTORY $<TARGET_FILE_DIR:t_dlfcn>)