From 059b526dceda1a4e35db959df289a19f84efc90f Mon Sep 17 00:00:00 2001 From: Aina Niemetz Date: Fri, 14 Sep 2018 11:50:07 -0700 Subject: [PATCH] cmake: examples: Configure output directory per target. --- examples/CMakeLists.txt | 7 +++++-- examples/api/CMakeLists.txt | 4 +++- examples/api/java/CMakeLists.txt | 2 +- examples/hashsmt/CMakeLists.txt | 7 +++++-- examples/nra-translate/CMakeLists.txt | 4 +++- examples/sets-translate/CMakeLists.txt | 5 ++++- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index be278f2ab..37efb84e1 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,5 +1,3 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples) - include_directories(${PROJECT_SOURCE_DIR}/src) include_directories(${PROJECT_SOURCE_DIR}/src/include) include_directories(${CMAKE_BINARY_DIR}/src) @@ -47,6 +45,8 @@ set(CVC4_EXAMPLES_SETS_TRANSLATE sets2axioms ) +set(EXAMPLES_BIN_DIR ${CMAKE_BINARY_DIR}/bin/examples) + add_executable(simple_vc_cxx EXCLUDE_FROM_ALL simple_vc_cxx.cpp) target_link_libraries(simple_vc_cxx cvc4 cvc4parser) @@ -56,6 +56,9 @@ target_link_libraries(simple_vc_quant_cxx cvc4 cvc4parser) add_executable(translator EXCLUDE_FROM_ALL translator.cpp) target_link_libraries(translator cvc4 cvc4parser) +set_target_properties(simple_vc_cxx simple_vc_quant_cxx translator + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXAMPLES_BIN_DIR}) + add_custom_target(examples DEPENDS ${CVC4_EXAMPLES} diff --git a/examples/api/CMakeLists.txt b/examples/api/CMakeLists.txt index 38dc563c0..55651e238 100644 --- a/examples/api/CMakeLists.txt +++ b/examples/api/CMakeLists.txt @@ -1,8 +1,10 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/api) +set(EXAMPLES_API_BIN_DIR ${EXAMPLES_BIN_DIR}/api) foreach(example ${CVC4_EXAMPLES_API}) add_executable(${example} EXCLUDE_FROM_ALL ${example}.cpp) target_link_libraries(${example} cvc4) + set_target_properties(${example} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXAMPLES_API_BIN_DIR}) endforeach() if(BUILD_BINDINGS_JAVA) diff --git a/examples/api/java/CMakeLists.txt b/examples/api/java/CMakeLists.txt index 049d390bd..bb70ab054 100644 --- a/examples/api/java/CMakeLists.txt +++ b/examples/api/java/CMakeLists.txt @@ -1,4 +1,4 @@ -set(EXAMPLES_API_JAVA_BIN_DIR ${CMAKE_BINARY_DIR}/bin/examples/api/java) +set(EXAMPLES_API_JAVA_BIN_DIR ${EXAMPLES_API_BIN_DIR}/java) file(MAKE_DIRECTORY ${EXAMPLES_API_JAVA_BIN_DIR}) add_custom_target(BitVectorsjava diff --git a/examples/hashsmt/CMakeLists.txt b/examples/hashsmt/CMakeLists.txt index 5a0e484c8..718399f79 100644 --- a/examples/hashsmt/CMakeLists.txt +++ b/examples/hashsmt/CMakeLists.txt @@ -1,9 +1,12 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/hashsmt) - include_directories(.) +set(EXAMPLES_HASHSMT_BIN_DIR ${EXAMPLES_BIN_DIR}/hashsmt) + add_executable(sha1_inversion EXCLUDE_FROM_ALL sha1_inversion.cpp word.cpp) target_link_libraries(sha1_inversion cvc4) add_executable(sha1_collision EXCLUDE_FROM_ALL sha1_collision.cpp word.cpp) target_link_libraries(sha1_collision cvc4) + +set_target_properties(sha1_inversion sha1_collision + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXAMPLES_HASHSMT_BIN_DIR}) diff --git a/examples/nra-translate/CMakeLists.txt b/examples/nra-translate/CMakeLists.txt index 0d20e9fed..2b1a849de 100644 --- a/examples/nra-translate/CMakeLists.txt +++ b/examples/nra-translate/CMakeLists.txt @@ -1,6 +1,8 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/nra-translate) +set(EXAMPLES_NRA_TRANSLATE_BIN_DIR ${EXAMPLES_BIN_DIR}/nra-translate) foreach(example ${CVC4_EXAMPLES_NRA_TRANSLATE}) add_executable(${example} EXCLUDE_FROM_ALL ${example}.cpp) target_link_libraries(${example} cvc4 cvc4parser) + set_target_properties(${example} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXAMPLES_NRA_TRANSLATE_BIN_DIR}) endforeach() diff --git a/examples/sets-translate/CMakeLists.txt b/examples/sets-translate/CMakeLists.txt index 8676994fd..fcbb8e3c8 100644 --- a/examples/sets-translate/CMakeLists.txt +++ b/examples/sets-translate/CMakeLists.txt @@ -1,4 +1,4 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/sets-translate) +set(EXAMPLES_SETS_TRANSLATE_BIN_DIR ${EXAMPLES_BIN_DIR}/sets-translate) add_executable(sets2arrays EXCLUDE_FROM_ALL sets_translate.cpp) target_link_libraries(sets2arrays cvc4 cvc4parser) @@ -6,3 +6,6 @@ target_link_libraries(sets2arrays cvc4 cvc4parser) add_executable(sets2axioms EXCLUDE_FROM_ALL sets_translate.cpp) target_compile_definitions(sets2axioms PRIVATE -DENABLE_AXIOMS) target_link_libraries(sets2axioms cvc4 cvc4parser) + +set_target_properties(sets2arrays sets2axioms + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXAMPLES_SETS_TRANSLATE_BIN_DIR}) -- 2.30.2