From eba62429780390be9d01b78582ea0ecf61ab7916 Mon Sep 17 00:00:00 2001 From: bakpakin Date: Fri, 8 Jun 2018 16:54:08 -0400 Subject: [PATCH] Update CMakeLists.txt for tests. --- CMakeLists.txt | 17 +++++++++++++---- test/suite0.dst | 1 + test/suite1.dst | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6a60393..60a68a3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,11 @@ set(TARGET_NAME ${PROJECT_NAME}) set (CMAKE_C_STANDARD 99) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +# Set configurations +SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") +SET(CMAKE_C_FLAGS_RELEASE "-O2") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") + include_directories(src/include) include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -112,10 +117,12 @@ src/include/dst/dsttypes.h # Build the executable add_executable(${TARGET_NAME} ${REPL_SOURCES}) -if (UNIX AND NOT EMSCRIPTEN) +if (APPLE) + # macOS flags here +elseif (UNIX AND NOT EMSCRIPTEN) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic") target_link_libraries(${TARGET_NAME} m dl) -endif (UNIX AND NOT EMSCRIPTEN) +endif (APPLE) set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${DST_PUBLIC_HEADERS}") # Generate header containing standard library @@ -152,8 +159,10 @@ endif (DEFINED EMSCRIPTEN) # Add some test scripts enable_testing() -add_test(suite0 ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite0.dst) -add_test(suite1 ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite1.dst) +add_test(NAME suite0 COMMAND ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite0.dst + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +add_test(NAME suite1 COMMAND ${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test/suite1.dst + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) # Add convenience script to run repl add_custom_target(run diff --git a/test/suite0.dst b/test/suite0.dst index 57d94998..58df91a6 100644 --- a/test/suite0.dst +++ b/test/suite0.dst @@ -18,6 +18,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +(print "Current working directory is: " (os.cwd)) (import test.helper :prefix "" :exit true) (start-suite 0) diff --git a/test/suite1.dst b/test/suite1.dst index c115301f..ef1b2b5a 100644 --- a/test/suite1.dst +++ b/test/suite1.dst @@ -18,6 +18,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +(print "Current working directory is: " (os.cwd)) (import test.helper :prefix "" :exit true) (start-suite 1)