From 21d05c4572f60a2363258ab905ba3fb68ec1fa4d Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Sat, 18 Mar 2017 21:30:26 -0400 Subject: [PATCH] remove tests requirement on threads, add setting to disable tests --- CMakeLists.txt | 7 ++----- samples/sample.cpp | 2 +- tests/CMakeLists.txt | 4 ---- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a5e6575..f5ba09ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ set(COMBINED_PROJECT TRUE) option(STATIC "Set to ON to build xlnt as a static library instead of a shared library" OFF) # Optional components +option(TESTS "Set to OFF to skip building test executable (in ./tests)" ON) option(SAMPLES "Set to ON to build executable code samples (in ./samples)" OFF) option(BENCHMARKS "Set to ON to build performance benchmarks (in ./benchmarks)" OFF) @@ -25,12 +26,8 @@ if(BENCHMARKS) add_subdirectory(benchmarks) endif() -find_package(PythonInterp) - -if(PYTHONINTERP_FOUND) +if(TESTS) add_subdirectory(tests) -elseif(NOT PYTHONINTERP_FOUND) - message("Python couldn't be found in the current PATH but is required for building tests. Tests will be skipped for now.") endif() add_subdirectory(source) diff --git a/samples/sample.cpp b/samples/sample.cpp index 0f9023da..aee01a86 100644 --- a/samples/sample.cpp +++ b/samples/sample.cpp @@ -9,7 +9,7 @@ int main() ws.cell("C3").formula("=RAND()"); ws.merge_cells("C3:C4"); ws.freeze_panes("B2"); - wb.save("data/sample.xlsx"); + wb.save("sample.xlsx"); return 0; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 142a7373..b05dfcd7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -80,10 +80,6 @@ source_group(runner FILES ${RUNNER}) if(MSVC) set_target_properties(xlnt.test PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\"") -else() - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(xlnt.test PRIVATE Threads::Threads) endif() find_package(PythonInterp REQUIRED)