diff --git a/channels/audin/client/oss/CMakeLists.txt b/channels/audin/client/oss/CMakeLists.txt index 6b747e457..5b4dac919 100644 --- a/channels/audin/client/oss/CMakeLists.txt +++ b/channels/audin/client/oss/CMakeLists.txt @@ -30,7 +30,12 @@ set(${MODULE_PREFIX}_LIBS ) include_directories(..) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${OSS_INCLUDE_DIRS}) - +configure_file( + ${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in + ${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h + @ONLY +) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") diff --git a/channels/audin/client/oss/audin_oss.c b/channels/audin/client/oss/audin_oss.c index 7bd9fa9af..c42c0894c 100644 --- a/channels/audin/client/oss/audin_oss.c +++ b/channels/audin/client/oss/audin_oss.c @@ -37,11 +37,7 @@ #include #include #include -#if defined(__OpenBSD__) -#include -#else -#include -#endif +#include #include #include diff --git a/channels/rdpsnd/client/oss/CMakeLists.txt b/channels/rdpsnd/client/oss/CMakeLists.txt index 83bd59f0a..c4957526a 100644 --- a/channels/rdpsnd/client/oss/CMakeLists.txt +++ b/channels/rdpsnd/client/oss/CMakeLists.txt @@ -30,6 +30,12 @@ set(${MODULE_PREFIX}_LIBS ) include_directories(..) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${OSS_INCLUDE_DIRS}) +configure_file( + ${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in + ${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h + @ONLY +) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") diff --git a/channels/rdpsnd/client/oss/rdpsnd_oss.c b/channels/rdpsnd/client/oss/rdpsnd_oss.c index d303f1dbc..84105fd92 100644 --- a/channels/rdpsnd/client/oss/rdpsnd_oss.c +++ b/channels/rdpsnd/client/oss/rdpsnd_oss.c @@ -37,11 +37,7 @@ #include #include #include -#if defined(__OpenBSD__) -#include -#else -#include -#endif +#include #include #include diff --git a/cmake/FindOSS.cmake b/cmake/FindOSS.cmake index 811e05209..7dcdbdd64 100644 --- a/cmake/FindOSS.cmake +++ b/cmake/FindOSS.cmake @@ -4,29 +4,27 @@ IF(UNIX) IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - SET(OSS_HDR_NAME "linux/soundcard.h") - ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") - IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - SET(OSS_HDR_NAME "sys/soundcard.h") - ELSE(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - IF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") - SET(OSS_HDR_NAME "soundcard.h") - ELSE(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") - SET(OSS_HDR_NAME "machine/soundcard.h") - ENDIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") - ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(PLATFORM_PREFIX "linux/") + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + set(PLATFORM_PREFIX "sys/") + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + set(PLATFORM_PREFIX "machine/") + ENDIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") ENDIF(UNIX) -FIND_PATH(OSS_INCLUDE_DIR "${OSS_HDR_NAME}" - "/usr/include" "/usr/local/include" +set(OSS_HDR_NAME "${PLATFORM_PREFIX}soundcard.h" CACHE STRING "oss header include file name") +FIND_PATH(OSS_INCLUDE_DIRS ${OSS_HDR_NAME} + PATHS + "/usr/local/include" + PATH_SUFFIXES + ${PLATFORM_SUFFIX} ) -IF(OSS_INCLUDE_DIR) - SET(OSS_FOUND TRUE) -ELSE(OSS_INCLUDE_DIR) - SET(OSS_FOUND) -ENDIF(OSS_INCLUDE_DIR) +IF(OSS_INCLUDE_DIRS) + SET(OSS_FOUND ON CACHE BOOL "oss detection status") +ELSE(OSS_INCLUDE_DIRS) + SET(OSS_FOUND OFF CACHE BOOL "oss detection status") +ENDIF(OSS_INCLUDE_DIRS) IF(OSS_FOUND) MESSAGE(STATUS "Found OSS Audio") @@ -40,5 +38,6 @@ ENDIF(OSS_FOUND) MARK_AS_ADVANCED ( OSS_FOUND - OSS_INCLUDE_DIR + OSS_HDR_NAME + OSS_INCLUDE_DIRS ) diff --git a/cmake/oss-includes.h.in b/cmake/oss-includes.h.in new file mode 100644 index 000000000..f3fb67351 --- /dev/null +++ b/cmake/oss-includes.h.in @@ -0,0 +1,6 @@ +#ifndef OSS_INCLUDES_H_ +#define OSS_INCLUDES_H_ + +#include <@OSS_HDR_NAME@> + +#endif /* OSS_INCLUDES_H_ */