-
Notifications
You must be signed in to change notification settings - Fork 5
/
TargetOption.cmake
42 lines (36 loc) · 1.74 KB
/
TargetOption.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
include_guard(GLOBAL)
# can be load multiple times and in different paths
if(NOT DEFINED __TARGET_OPTION_LOADED)
set(__TARGET_OPTION_LOADED 1)
include(GNUInstallDirs)
# add CMAKE_INSTALL_*, CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_INCLUDEDIR and etc.
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
endif()
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
endif()
link_directories(${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
endif()
if(NOT PROJECT_PREBUILT_PLATFORM_NAME)
if(ANDROID_ABI)
string(TOLOWER "${CMAKE_SYSTEM_NAME}-${ANDROID_ABI}-${CMAKE_CXX_COMPILER_ID}" PROJECT_PREBUILT_PLATFORM_NAME)
elseif(CMAKE_OSX_ARCHITECTURES)
string(TOLOWER "${CMAKE_SYSTEM_NAME}-${CMAKE_OSX_ARCHITECTURES}-${CMAKE_CXX_COMPILER_ID}"
PROJECT_PREBUILT_PLATFORM_NAME)
else()
string(TOLOWER "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_CXX_COMPILER_ID}"
PROJECT_PREBUILT_PLATFORM_NAME)
endif()
endif()
if(NOT PROJECT_PREBUILT_HOST_PLATFORM_NAME)
string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}-${CMAKE_CXX_COMPILER_ID}"
PROJECT_PREBUILT_HOST_PLATFORM_NAME)
if(CMAKE_CROSSCOMPILING AND PROJECT_PREBUILT_HOST_PLATFORM_NAME STREQUAL PROJECT_PREBUILT_PLATFORM_NAME)
string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}-host-${CMAKE_HOST_SYSTEM_PROCESSOR}-${CMAKE_CXX_COMPILER_ID}"
PROJECT_PREBUILT_HOST_PLATFORM_NAME)
endif()
endif()