Remove unnecessary CMake modules and fixup os/CMakeLists.txt

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2018-12-20 16:26:15 +01:00
parent 1990007614
commit e25656a4c5
39 changed files with 406 additions and 210 deletions

View file

@ -1,42 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if (NOT TARGET Abstraction)
add_library(Abstraction INTERFACE)
endif()
# Link with the platform-specific threads library that find_package provides us
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
target_link_libraries(Abstraction INTERFACE Threads::Threads)
if(WIN32)
# Link with WIN32 core-libraries
target_link_libraries(Abstraction INTERFACE wsock32 ws2_32 iphlpapi)
# Many of the secure versions provided by Microsoft have failure modes
# which are not supported by our abstraction layer, so efforts trying
# to use the _s versions aren't typically the proper solution and C11
# (which contains most of the secure versions) is 'too new'. So we rely
# on static detection of misuse instead of runtime detection, so all
# these warnings can be disabled on Windows.
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) #Disabled warnings for deprecated Winsock 2 API calls in general
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) #Disabled warnings for deprecated POSIX names
elseif(UNIX AND NOT APPLE)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
# Shared libs will have this by default. Static libs need it too on x86_64.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
find_package(GetTime REQUIRED)
target_link_libraries(Abstraction INTERFACE GetTime)
endif()

View file

@ -1,28 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if (NOT TARGET GetTime)
add_library(GetTime INTERFACE)
endif()
include(CheckLibraryExists)
# First check whether libc has clock_gettime
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME_IN_C)
if(NOT HAVE_CLOCK_GETTIME_IN_C)
# Before glibc 2.17, clock_gettime was in librt
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_IN_RT)
if (HAVE_CLOCK_GETTIME_IN_RT)
target_link_libraries(GetTime INTERFACE rt)
endif()
endif()