diff --git a/CMakeLists.txt b/CMakeLists.txt index b7a4961..36e7d1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,9 @@ set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VE # compile in release with debug info mode by default SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build Type") +# Build all binaries in a separate directory +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON) option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON) option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index cd355b4..1523c63 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -15,5 +15,5 @@ set(EXAMPLES tutorial) foreach (example ${EXAMPLES}) - add_executable(${example}_ ${example}/${example}.cpp) + add_executable(${example} ${example}/${example}.cpp) endforeach() diff --git a/test/perftest/CMakeLists.txt b/test/perftest/CMakeLists.txt index 3589567..8d5d4e3 100644 --- a/test/perftest/CMakeLists.txt +++ b/test/perftest/CMakeLists.txt @@ -7,5 +7,5 @@ set(PERFTEST_SOURCES add_executable(perftest ${PERFTEST_SOURCES}) target_link_libraries(perftest ${TEST_LIBRARIES}) add_test(NAME perftest - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/perftest + COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perftest WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index fa687e7..2e8c05f 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -13,5 +13,5 @@ set(UNITTEST_SOURCES add_executable(unittest ${UNITTEST_SOURCES}) target_link_libraries(unittest ${TEST_LIBRARIES}) add_test(NAME unittest - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unittest + COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)