From e740f7bcba42c5c8d6182240b02b346bc9ef4aee Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 6 Apr 2017 16:29:52 -0500 Subject: [PATCH] Add install for OxStd and add OX_RUN_TESTS CMake flag --- CMakeLists.txt | 6 ++++++ src/ox/fs/CMakeLists.txt | 12 ++++++++---- src/ox/std/CMakeLists.txt | 7 ++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56bd64304..d093272fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,12 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) include(address_sanitizer) set(OX_BUILD_EXEC "ON" CACHE STRING "Build executables (ON/OFF)") +set(OX_RUN_TESTS "ON" CACHE STRING "Run tests (ON/OFF)") + +# can't run tests without building them +if(OX_BUILD_EXEC STREQUAL "OFF") + set(OX_RUN_TESTS "OFF") +endif() if(NOT MSVC) add_definitions( diff --git a/src/ox/fs/CMakeLists.txt b/src/ox/fs/CMakeLists.txt index 3bd7a0117..c7cd44c28 100644 --- a/src/ox/fs/CMakeLists.txt +++ b/src/ox/fs/CMakeLists.txt @@ -23,13 +23,17 @@ install( include/ox/fs ) -install(TARGETS OxFS - LIBRARY DESTINATION lib/ox - ARCHIVE DESTINATION lib/ox +install( + TARGETS + OxFS + LIBRARY DESTINATION lib/ox + ARCHIVE DESTINATION lib/ox ) if(OX_BUILD_EXEC STREQUAL "ON") - add_subdirectory(test) + if(OX_RUN_TESTS STREQUAL "ON") + add_subdirectory(test) + endif() install(TARGETS oxfstool RUNTIME DESTINATION bin ) diff --git a/src/ox/std/CMakeLists.txt b/src/ox/std/CMakeLists.txt index c2bba8567..f24ef2fdf 100644 --- a/src/ox/std/CMakeLists.txt +++ b/src/ox/std/CMakeLists.txt @@ -16,6 +16,11 @@ install( include/ox/std ) -if(OX_BUILD_EXEC STREQUAL "ON") +install(TARGETS OxStd + LIBRARY DESTINATION lib/ox + ARCHIVE DESTINATION lib/ox +) + +if(OX_RUN_TESTS STREQUAL "ON") add_subdirectory(test) endif()