From 36d8aeabd384b8d2b5062879b7a0a2d06e889017 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 15 Jun 2019 09:44:04 -0500 Subject: [PATCH] [ox] Fix incorrect setting of build config when passed in from another CMakeLists.txt --- deps/ox/CMakeLists.txt | 21 +++++++++++++++++---- deps/ox/src/ox/fs/CMakeLists.txt | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/deps/ox/CMakeLists.txt b/deps/ox/CMakeLists.txt index a15dc707..32a5b0da 100644 --- a/deps/ox/CMakeLists.txt +++ b/deps/ox/CMakeLists.txt @@ -5,10 +5,23 @@ project(Ox) 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)") -set(OX_USE_STDLIB "ON" CACHE STRING "Build libraries that need the std lib (ON/OFF)") -set(OX_BARE_METAL FALSE CACHE STRING "Bare metal build (TRUE/FALSE)") +if(NOT DEFINED OX_RUN_TESTS) + set(OX_RUN_TESTS "ON") +endif() +if(NOT DEFINED OX_RUN_TESTS) + set(OX_RUN_TESTS "ON") +endif() +if(NOT DEFINED OX_USE_STDLIB) + set(OX_USE_STDLIB "ON") +endif() +if(NOT DEFINED OX_BARE_METAL) + set(OX_BARE_METAL FALSE) +endif() + +set(OX_RUN_TESTS ${OX_RUN_TESTS} CACHE STRING "Run tests (ON/OFF)") +set(OX_RUN_TESTS ${OX_RUN_TESTS} CACHE STRING "Run tests (ON/OFF)") +set(OX_USE_STDLIB ${OX_USE_STDLIB} CACHE STRING "Build libraries that need the std lib (ON/OFF)") +set(OX_BARE_METAL ${OX_BARE_METAL} CACHE STRING "Bare metal build (TRUE/FALSE)") # can't run tests without building them if(OX_BUILD_EXEC STREQUAL "OFF" OR OX_USE_STDLIB STREQUAL "OFF") diff --git a/deps/ox/src/ox/fs/CMakeLists.txt b/deps/ox/src/ox/fs/CMakeLists.txt index 9caea74c..cc0bbed5 100644 --- a/deps/ox/src/ox/fs/CMakeLists.txt +++ b/deps/ox/src/ox/fs/CMakeLists.txt @@ -10,6 +10,7 @@ add_library( ) if(NOT OX_BARE_METAL) + message("fs link c++fs") target_link_libraries( OxFS PUBLIC $<$:c++fs>