CodeCommitsIssuesPull requestsActionsInsightsSecurity
48ab9afce6f76940b27e41cf3be15877686d525c

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

cmake/darwin/default_libs.cmake

37lines · modecode

6 years ago
1set (DEFAULT_LIBS "-nodefaultlibs")
2
3if (NOT COMPILER_CLANG)
4 message (FATAL_ERROR "Darwin build is supported only for Clang")
5endif ()
6
7set (DEFAULT_LIBS "${DEFAULT_LIBS} ${COVERAGE_OPTION} -lc -lm -lpthread -ldl")
8
9message(STATUS "Default libraries: ${DEFAULT_LIBS}")
10
11set(CMAKE_CXX_STANDARD_LIBRARIES ${DEFAULT_LIBS})
12set(CMAKE_C_STANDARD_LIBRARIES ${DEFAULT_LIBS})
13
14# Global libraries
15
16add_library(global-libs INTERFACE)
17
18# Unfortunately '-pthread' doesn't work with '-nodefaultlibs'.
19# Just make sure we have pthreads at all.
20set(THREADS_PREFER_PTHREAD_FLAG ON)
21find_package(Threads REQUIRED)
22
23include (cmake/find/cxx.cmake)
24
25add_library(global-group INTERFACE)
26
27target_link_libraries(global-group INTERFACE
28 $<TARGET_PROPERTY:global-libs,INTERFACE_LINK_LIBRARIES>
29)
30
31link_libraries(global-group)
32
33# FIXME: remove when all contribs will get custom cmake lists
34install(
35 TARGETS global-group global-libs
36 EXPORT global
37)