From 8b0fbfcd12c7f58ad73678f72681c5f75c1d5880 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 17 Feb 2011 12:35:01 -0800 Subject: uhd: use source properties to set flags and defs not globally, but only for the source --- host/lib/utils/CMakeLists.txt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'host/lib/utils') diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index 5fa5b4d6d..743528189 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -48,14 +48,19 @@ CHECK_CXX_SOURCE_COMPILES(" IF(HAVE_PTHREAD_SETSCHEDPARAM) MESSAGE(STATUS " Priority scheduling supported through pthread_setschedparam.") - ADD_DEFINITIONS(-DHAVE_PTHREAD_SETSCHEDPARAM) + SET(THREAD_PRIO_DEFS HAVE_PTHREAD_SETSCHEDPARAM) ELSEIF(HAVE_WIN_SETTHREADPRIORITY) MESSAGE(STATUS " Priority scheduling supported through windows SetThreadPriority.") - ADD_DEFINITIONS(-DHAVE_WIN_SETTHREADPRIORITY) + SET(THREAD_PRIO_DEFS HAVE_WIN_SETTHREADPRIORITY) ELSE(HAVE_PTHREAD_SETSCHEDPARAM) MESSAGE(STATUS " Priority scheduling not supported.") ENDIF(HAVE_PTHREAD_SETSCHEDPARAM) +SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/thread_priority.cpp + PROPERTIES COMPILE_DEFINITIONS "${THREAD_PRIO_DEFS}" +) + ######################################################################## # Setup defines for module loading ######################################################################## @@ -68,15 +73,20 @@ CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H) IF(HAVE_DLFCN_H) MESSAGE(STATUS " Module loading supported through dlopen.") - ADD_DEFINITIONS(-DHAVE_DLFCN_H) + SET(LOAD_MODULES_DEFS HAVE_DLFCN_H) LIBUHD_APPEND_LIBS(${CMAKE_DL_LIBS}) ELSEIF(HAVE_WINDOWS_H) MESSAGE(STATUS " Module loading supported through LoadLibrary.") - ADD_DEFINITIONS(-DHAVE_WINDOWS_H) + SET(LOAD_MODULES_DEFS HAVE_WINDOWS_H) ELSE(HAVE_DLFCN_H) MESSAGE(STATUS " Module loading not supported.") ENDIF(HAVE_DLFCN_H) +SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/load_modules.cpp + PROPERTIES COMPILE_DEFINITIONS "${LOAD_MODULES_DEFS}" +) + ######################################################################## # Append sources ######################################################################## -- cgit v1.2.3