Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'cmake-tcf-lib.txt')
-rw-r--r--cmake-tcf-lib.txt63
1 files changed, 34 insertions, 29 deletions
diff --git a/cmake-tcf-lib.txt b/cmake-tcf-lib.txt
index da24175a..83c205c3 100644
--- a/cmake-tcf-lib.txt
+++ b/cmake-tcf-lib.txt
@@ -1,32 +1,23 @@
# -*- cmake -*-
-if(WIN32)
-if(NOT TCF_OPSYS)
- set(TCF_OPSYS "Windows")
+set(default_opsys ${CMAKE_SYSTEM_NAME})
+if(default_opsys MATCHES "Linux|Android")
+ set(default_opsys GNU/Linux)
endif()
-if(NOT TCF_MACHINE)
- set(TCF_MACHINE "x86_64")
+
+set(default_machine ${CMAKE_SYSTEM_PROCESSOR})
+if(default_machine MATCHES "^(amd64|AMD64)$")
+ set(default_machine x86_64)
+elseif(default_machine MATCHES "^(armv6l|armv7l|armv7-a)$")
+ set(default_machine arm)
+elseif(default_machine STREQUAL "ppc64")
+ set(default_machine powerpc)
+elseif(default_machine STREQUAL "aarch64")
+ set(default_machine a64)
endif()
-endif(WIN32)
-if(ANDROID)
- if(NOT TCF_OPSYS)
- set(TCF_OPSYS "GNU/Linux")
- endif()
- if(NOT TCF_MACHINE)
- if(ARMEABI OR ARMEABI_V6 OR ARMEABI_V7A)
- set(TCF_MACHINE "arm")
- elseif(ARM64_V8A )
- set(TCF_MACHINE "a64")
- elseif(X86 )
- set(TCF_MACHINE "i686")
- elseif(X86_64 )
- set(TCF_MACHINE "x86_64")
- else()
- message( FATAL_ERROR "Unsupported ABI " ${ANDROID_ABI} )
- endif()
- endif()
-endif(ANDROID)
+set(TCF_MACHINE ${default_machine} CACHE STRING "TCF machine")
+set(TCF_OPSYS ${default_opsys} CACHE STRING "TCF operating system")
if (NOT TCF_DIR)
set(TCF_DIR ${CMAKE_CURRENT_LIST_DIR})
@@ -91,12 +82,26 @@ endif()
include_directories(${TCF_BASE_DIR} ${TCF_BASE_DIR}/system/${TCF_OPSYS} ${TCF_BASE_DIR}/machine/${TCF_MACHINE})
-set_source_files_properties(${TCF_SRCS} PROPERTIES
- COMPILE_FLAGS "${MULTI_THREADED_COMPILE_FLAGS}")
add_library(${TCF_LIB_NAME} ${TCF_LIB_TYPE} ${TCF_SRCS})
-target_link_libraries(${TCF_LIB_NAME}
- ${UUID_LIB_NAME} ${MULTI_THREADED_LINK_LIBS} ${SOCKET_LINK_LIBS})
-
+find_package(Threads)
+target_link_libraries(${TCF_LIB_NAME} Threads::Threads)
+find_library(LIBRT rt)
+if(LIBRT)
+ target_link_libraries(${TCF_LIB_NAME} ${LIBRT})
+endif()
+find_library(LIBUUID uuid)
+if(LIBUUID)
+ target_link_libraries(${TCF_LIB_NAME} ${LIBUUID})
+else()
+ target_compile_definitions(${TCF_LIB_NAME} PUBLIC USE_uuid_generate=0)
+endif()
+if(WIN32)
+ target_link_libraries(${TCF_LIB_NAME} version.lib psapi.lib ws2_32 iphlpapi)
+endif()
+if(ANDROID)
+ find_library(LIBLOG log)
+ target_link_libraries(${TCF_LIB_NAME} ${LIBLOG})
+endif()
if(SSL_LIB_NAME)
target_link_libraries(${TCF_LIB_NAME} ${SSL_LIB_NAME})
else()

Back to the top