From fa73977a86c55c9d0122971113a906a8f43d3f34 Mon Sep 17 00:00:00 2001 From: magiblot Date: Mon, 5 Feb 2024 09:55:23 +0100 Subject: [PATCH] Output compiled examples in the root build directory --- CMakeLists.txt | 4 +++- source/examples/CMakeLists.txt | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3399ed9..dbb5756 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ endif() project (turbo) +set(TURBO_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + # Target 'scintilla' # These two could be built in one single target, but we want to enable Unity Build @@ -189,7 +191,7 @@ if (TURBO_BUILD_TESTS) COMMAND ${TURBO}-test COMMAND ${CMAKE_COMMAND} -E touch ${TURBO}-test-passed DEPENDS ${TURBO}-test - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${TURBO_BINARY_DIR} ) add_custom_target(${TURBO}-test-run ALL DEPENDS ${TURBO}-test-passed) if (NOT TURBO_USE_SYSTEM_TVISION) diff --git a/source/examples/CMakeLists.txt b/source/examples/CMakeLists.txt index 6af795d..85eee10 100644 --- a/source/examples/CMakeLists.txt +++ b/source/examples/CMakeLists.txt @@ -7,6 +7,7 @@ project(turbo-examples) set(MASTER_PROJECT FALSE) if (CMAKE_CURRENT_LIST_DIR STREQUAL CMAKE_SOURCE_DIR) set(MASTER_PROJECT TRUE) + set(TURBO_BINARY_DIR ${CMAKE_BINARY_DIR}) endif() if (MASTER_PROJECT) @@ -20,6 +21,12 @@ if (TURBO_BUILD_EXAMPLES OR MASTER_PROJECT) function(add_example_generic app) add_executable(${app} ${app}.cc) target_link_libraries(${app} PRIVATE turbo-core) + # Place everything in the root build directory, for ease of use. + set_target_properties(${app} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${TURBO_BINARY_DIR} + LIBRARY_OUTPUT_DIRECTORY ${TURBO_BINARY_DIR} + RUNTIME_OUTPUT_DIRECTORY ${TURBO_BINARY_DIR} + ) endfunction() add_example_generic(demo-with-custom-editor-window)