From 58179783887fa7cf59a9609dee942c4ab49599c0 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 12 Jun 2019 14:05:02 +0100 Subject: [PATCH] Make new.cc only compile once Each test was compiling new.cc for every go. This optimises that to just compile it once. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3649761..2bb1590 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,8 @@ if(NOT DEFINED SNMALLOC_ONLY_HEADER_LIBRARY) enable_testing() + add_library(overide_new STATIC src/override/new.cc) + set(TESTDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/test) subdirlist(TEST_CATEGORIES ${TESTDIR}) list(REVERSE TEST_CATEGORIES) @@ -123,12 +125,12 @@ if(NOT DEFINED SNMALLOC_ONLY_HEADER_LIBRARY) aux_source_directory(${TESTDIR}/${TEST_CATEGORY}/${TEST} SRC) set(TESTNAME "${TEST_CATEGORY}-${TEST}-${SUPER_SLAB_SIZE}") - add_executable(${TESTNAME} ${SRC} src/override/new.cc) + add_executable(${TESTNAME} ${SRC}) if (${SUPER_SLAB_SIZE} EQUAL 1) target_compile_definitions(${TESTNAME} PRIVATE IS_ADDRESS_SPACE_CONSTRAINED) endif() target_include_directories(${TESTNAME} PRIVATE src) - target_link_libraries(${TESTNAME} snmalloc_lib) + target_link_libraries(${TESTNAME} snmalloc_lib overide_new) if (${TEST} MATCHES "release-.*") message(STATUS "Adding test: ${TESTNAME} only for release configs") add_test(NAME ${TESTNAME} COMMAND ${TESTNAME} CONFIGURATIONS "Release")