Merge pull request #4608 from akallabeth/posix_timer_cmake_check
Determine posix timer use by function availability
This commit is contained in:
commit
fbb21e3499
@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include(CheckFunctionExists)
|
||||
|
||||
set(WINPR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(WINPR_SRCS "")
|
||||
set(WINPR_LIBS "")
|
||||
@ -67,6 +69,16 @@ macro (winpr_definition_add)
|
||||
set (WINPR_DEFINITIONS ${WINPR_DEFINITIONS} PARENT_SCOPE)
|
||||
endmacro()
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES rt)
|
||||
check_function_exists(timer_create TIMER_CREATE)
|
||||
check_function_exists(timer_delete TIMER_DELETE)
|
||||
check_function_exists(timer_settime TIMER_SETTIME)
|
||||
check_function_exists(timer_gettime TIMER_GETTIME)
|
||||
if (TIMER_CREATE AND TIMER_DELETE AND TIMER_SETTIME AND TIMER_GETTIME)
|
||||
add_definitions(-DWITH_POSIX_TIMER)
|
||||
winpr_library_add(rt)
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
winpr_library_add(log)
|
||||
endif()
|
||||
|
@ -35,10 +35,6 @@ if(FREEBSD)
|
||||
winpr_library_add(${EPOLLSHIM_LIBS})
|
||||
endif()
|
||||
|
||||
if((NOT WIN32) AND (NOT APPLE) AND (NOT ANDROID) AND (NOT OPENBSD))
|
||||
winpr_library_add(rt)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
@ -28,10 +28,6 @@
|
||||
|
||||
#include <winpr/synch.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#define WITH_POSIX_TIMER 1
|
||||
#endif
|
||||
|
||||
#include "../handle/handle.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user