From 2f867eece9736a6394587eb943f9136c70c2d4a7 Mon Sep 17 00:00:00 2001 From: tigertv Date: Tue, 8 Dec 2020 12:39:16 +0200 Subject: [PATCH] Place binary output files in directories --- CMakeLists.txt | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c10e5fe..19f02de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,24 +16,31 @@ else() add_compile_options(-Wall -Wextra -pedantic) endif() +# sources include_directories(include) aux_source_directory(src/Bint BINT_SRC) set(BINT_SRC ${BINT_SRC} src/Bint.cpp) set(MATH_SRC src/Math.cpp) add_library(shareobjects OBJECT ${BINT_SRC} ${MATH_SRC}) +# libraries +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +add_library(Bint SHARED ${BINT_SRC} ${MATH_SRC}) +add_library(Bint_static STATIC $) +set_target_properties(Bint_static PROPERTIES OUTPUT_NAME Bint) + +# tests +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests") + add_executable(test-main-fast tests/main.cpp ${BINT_SRC} ${MATH_SRC}) set_target_properties(test-main-fast PROPERTIES COMPILE_FLAGS -Ofast) -add_test(NAME tst-main-fast COMMAND ./test-main-fast) +add_test(NAME tst-main-fast COMMAND ./tests/test-main-fast) aux_source_directory(tests TESTS) foreach(tstfile ${TESTS}) string(REGEX MATCH "\/(.*)\\.[^.]*$" dummy ${tstfile}) add_executable(test-${CMAKE_MATCH_1} ${tstfile} $) - add_test(NAME tst-${CMAKE_MATCH_1} COMMAND ./test-${CMAKE_MATCH_1}) + add_test(NAME tst-${CMAKE_MATCH_1} COMMAND ./tests/test-${CMAKE_MATCH_1}) endforeach() - -add_library(Bint SHARED ${BINT_SRC} ${MATH_SRC}) -add_library(Bint_static STATIC $) -set_target_properties(Bint_static PROPERTIES OUTPUT_NAME Bint) -