From 30bd3d052687b34e136f400a73f1a6569c5529a8 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sun, 22 Oct 2023 12:58:19 +0200 Subject: [PATCH] build: write binaries to bin folder --- .gitignore | 3 ++- CMakeLists.txt | 6 ++++++ bootstrap.sh | 2 +- build.sh | 2 +- test.sh | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 65af97a..be9452d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -/build +/.build /.cache +/bin diff --git a/CMakeLists.txt b/CMakeLists.txt index 31c0d68..88fc91b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,12 @@ target_include_directories( target_link_libraries(book_exercises PRIVATE chapter_02) +set_target_properties( + book_exercises + PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin") + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) add_subdirectory(tests) endif() diff --git a/bootstrap.sh b/bootstrap.sh index abf65d4..ba2fa51 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,3 +1,3 @@ #!/usr/bin/env sh -cmake -S . -B build -G Ninja -D CMAKE_EXPORT_COMPILE_COMMANDS=ON +cmake -S . -B .build -G Ninja -D CMAKE_EXPORT_COMPILE_COMMANDS=ON diff --git a/build.sh b/build.sh index 6479e4f..d26a5a3 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/usr/bin/env sh -cmake --build build +cmake --build .build diff --git a/test.sh b/test.sh index dd1e614..dd961ba 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,3 @@ #!/usr/bin/env sh -cmake --build build && cmake --build build --target test +cmake --build .build && cmake --build .build --target test