From d2bd60f40f7e7c7ee74b3b09a3bf1bffe669fd3d Mon Sep 17 00:00:00 2001 From: Blake-Madden <66873089+Blake-Madden@users.noreply.github.com> Date: Tue, 28 May 2024 09:17:54 -0400 Subject: [PATCH] Fix building demo file --- tests/demo/CMakeLists.txt | 13 ++++++------- tests/demo/tedemo.cpp | 9 ++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/demo/CMakeLists.txt b/tests/demo/CMakeLists.txt index 2781a99..769a6d3 100644 --- a/tests/demo/CMakeLists.txt +++ b/tests/demo/CMakeLists.txt @@ -7,13 +7,12 @@ # Licence: 3-Clause BSD licence ############################################################################# -PROJECT(TEDemo) +project(TEDemo) -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) -SET(CMAKE_CXX_STANDARD 17) -SET(CMAKE_CXX_STANDARD_REQUIRED True) +cmake_minimum_required(VERSION 3.12) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) - -ADD_EXECUTABLE(${CMAKE_PROJECT_NAME} tinyexpr.cpp tedemo.cpp) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) +add_executable(${CMAKE_PROJECT_NAME} ../../tinyexpr.cpp tedemo.cpp) diff --git a/tests/demo/tedemo.cpp b/tests/demo/tedemo.cpp index 17b0838..11046b2 100644 --- a/tests/demo/tedemo.cpp +++ b/tests/demo/tedemo.cpp @@ -1,14 +1,13 @@ // This is mostly used as a CMake project used for code analysis. -#include "tinyexpr.h" +#include "../../tinyexpr.h" #include -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { te_parser tep; - const char *c = "sqrt(5^2+7^2+11^2+(8-2)^2)"; + const char* c = "sqrt(5^2+7^2+11^2+(8-2)^2)"; double r = tep.evaluate(c); - std::cout << "The expression:\n\t" << - c << "\nevaluates to:\n\t" << r << "\n"; + std::cout << "The expression:\n\t" << c << "\nevaluates to:\n\t" << r << "\n"; return EXIT_SUCCESS; }