From e733e590c4b5aa3053af0681bef199d27e4b2d7a Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Fri, 13 Apr 2018 12:32:31 -0700 Subject: mpm: Validate MPM_DEVICE in CMake --- mpm/CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mpm') diff --git a/mpm/CMakeLists.txt b/mpm/CMakeLists.txt index 8129f3eff..b9afd70be 100644 --- a/mpm/CMakeLists.txt +++ b/mpm/CMakeLists.txt @@ -124,8 +124,15 @@ SET(PKG_MAN_DIR share/man/man1) # Setup library configuration ######################################################################## SET(CMAKE_CXX_STANDARD 11) +SET(MPM_ALL_DEVICES n3xx tests) SET(MPM_DEVICE "n3xx" CACHE STRING "Choose an MPM device to build") -SET_PROPERTY(CACHE MPM_DEVICE PROPERTY STRINGS n3xx tests) +SET_PROPERTY(CACHE MPM_DEVICE PROPERTY STRINGS ${MPM_ALL_DEVICES}) +# Validate MPM_DEVICE +list(FIND MPM_ALL_DEVICES ${MPM_DEVICE} mpm_device_check) +if(mpm_device_check EQUAL -1) + message(FATAL_ERROR "MPM_DEVICE must be one of ${MPM_ALL_DEVICES}! \ + Specify -DMPM_DEVICE= on the command line or set MPM_DEVICE using a CMake GUI.") +endif() ADD_SUBDIRECTORY(include) INCLUDE_DIRECTORIES( @@ -177,3 +184,4 @@ IF(MPM_VERSION_DEVEL AND NOT MPM_GIT_BRANCH STREQUAL "maint") MESSAGE(STATUS "******************************************************") ENDIF(MPM_VERSION_DEVEL AND NOT MPM_GIT_BRANCH STREQUAL "maint") MESSAGE(STATUS "Building version: ${MPM_VERSION}") +MESSAGE(STATUS "Building for device: ${MPM_DEVICE}") -- cgit v1.2.3