Merge pull request #98 from eboasson/master

Fix ARM builds and "make install"
This commit is contained in:
eboasson 2019-01-20 10:17:06 +01:00 committed by GitHub
commit b91513aec5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 29 deletions

View file

@ -57,6 +57,7 @@ add_library(OSAPI ${sources})
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
target_link_libraries(OSAPI INTERFACE Threads::Threads)
set_property(TARGET OSAPI PROPERTY POSITION_INDEPENDENT_CODE TRUE)
if(WIN32)
# Link with Win32 core-libraries
@ -73,17 +74,13 @@ if(WIN32)
target_compile_definitions(OSAPI PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
# Disable warnings for deprecated POSIX names.
target_compile_definitions(OSAPI PRIVATE -D_CRT_NONSTDC_NO_DEPRECATE)
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_property(TARGET OSAPI PROPERTY POSITION_INDEPENDENT_CODE TRUE)
endif()
elseif(UNIX)
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME)
if(NOT HAVE_CLOCK_GETTIME)
# Before glibc 2.17, clock_gettime was in librt.
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if(HAVE_CLOCK_GETTIME)
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
if(HAVE_CLOCK_GETTIME_RT)
set(HAVE_CLOCK_GETTIME "${HAVE_CLOCK_GETTIME_RT}")
target_link_libraries(OSAPI INTERFACE rt)
endif()
endif()
@ -95,7 +92,6 @@ endif()
if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
target_link_libraries(OSAPI INTERFACE -lsocket -lnsl)
add_definitions(-KPIC)
endif()
# Determine if platform is big or little endian.
@ -124,12 +120,18 @@ if(BUILD_TESTING)
add_subdirectory(tests)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/os/${system_name}/os_platform_public.h")
set(os_platform_public_h "${CMAKE_CURRENT_SOURCE_DIR}/include/os/${system_name}/os_platform_public.h")
else()
set(os_platform_public_h "${CMAKE_CURRENT_SOURCE_DIR}/include/os/posix/os_platform_public.h")
endif()
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_public.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes_sal.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/${system_name}/os_platform_public.h"
"${os_platform_public_h}"
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/ddsc/os"
COMPONENT