Commit 3016f1d1 authored by chuck cranor's avatar chuck cranor

more cmake updates

parent d6a3475d
......@@ -35,10 +35,13 @@ if (NOT CMAKE_BUILD_TYPE)
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif ()
set (CMAKE_PREFIX_PATH "" CACHE
STRING "Path used to find external dependencies")
set (BUILD_SHARED_LIBS "OFF" CACHE
BOOL "Build a shared library")
set (DEBUG_SANITIZER Off CACHE STRING "Sanitizer for debug builds")
set_property (CACHE DEBUG_SANITIZER PROPERTY STRINGS
"Off" "Address" "Thread")
set (CMAKE_PREFIX_PATH "" CACHE STRING "External dependencies path")
set (BUILD_SHARED_LIBS "OFF" CACHE BOOL "Build a shared library")
set (BUILD_EXAMPLES "OFF" CACHE BOOL "Build example programs")
set (BUILD_TESTS "OFF" CACHE BOOL "Build test programs")
find_package (mercury CONFIG)
find_package (abt-snoozer CONFIG) # will pull argobots and libev for us
......@@ -55,7 +58,27 @@ if (NOT MKTEMP)
message (FATAL_ERROR "Cannot find GNU 'mktemp' program for tests")
endif ()
#
# sanitizer config (XXX: does not probe compiler to see if sanitizer flags
# are supported... )
#
set (as_flags "-fsanitize=address,leak -O1 -fno-omit-frame-pointer")
set (ts_flags "-fsanitize=thread -O1 -fno-omit-frame-pointer")
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if (${DEBUG_SANITIZER} STREQUAL "Address")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${as_flags}")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${as_flags}")
elseif (${DEBUG_SANITIZER} STREQUAL "Thread")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${ts_flags}")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${ts_flags}")
endif ()
endif ()
enable_testing ()
add_subdirectory (src)
if (BUILD_EXAMPLES)
add_subdirectory (examples)
add_subdirectory (tests)
endif ()
if (BUILD_TESTS)
add_subdirectory (tests)
endif ()
......@@ -22,10 +22,7 @@ endforeach ()
foreach (lcv ${margo-tests})
# need a test name... use regex to extract the file basename into ${id}
string (REGEX REPLACE ".*/" "" id ${lcv})
string (REGEX REPLACE "([A-Za-z0-9_]+)\\.c+$" "\\1" id ${id})
get_filename_component(id ${lcv} NAME_WE) # remove extension
add_test (NAME ${id}
COMMAND env srcdir=${CMAKE_SOURCE_DIR}
TIMEOUT=${TIMEOUT}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment