blob: dbed87ed6d8d7fa64de0d69e8513afdfb2c24b48 (
plain)
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
43
44
45
46
47
48
49
50
51
|
# set default configuration directory
if(NOT CONF_DIR)
set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc CACHE PATH "Configuration directory")
message(STATUS "UNIX: Using default configuration directory")
endif()
# configure uninstaller
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/platform/cmake_uninstall.in.cmake"
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY
)
message(STATUS "UNIX: Configuring uninstall target")
# create uninstaller target (allows for using "make uninstall")
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
)
message(STATUS "UNIX: Created uninstall target")
if(USE_LD_GOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
message(STATUS "UNIX: Using GNU gold linker")
else()
message(WARNING "UNIX: GNU gold linker isn't available, using the default system linker")
endif()
else()
message(STATUS "UNIX: Using default system linker")
endif()
if(APPLE)
find_program(HOMEBREW_EXECUTABLE brew)
if (HOMEBREW_EXECUTABLE)
# setup homebrew paths
message(STATUS "Homebrew found at ${HOMEBREW_EXECUTABLE}")
execute_process(COMMAND ${HOMEBREW_EXECUTABLE} config OUTPUT_VARIABLE HOMEBREW_STATUS_STR)
string(REGEX MATCH "HOMEBREW_PREFIX: ([^\n]*)" HOMEBREW_STATUS_STR ${HOMEBREW_STATUS_STR})
set(HOMEBREW_PREFIX ${CMAKE_MATCH_1})
message(STATUS "Homebrew installation found at ${HOMEBREW_PREFIX}")
set(CMAKE_PREFIX_PATH "${HOMEBREW_PREFIX}")
endif()
endif()
message(STATUS "UNIX: Detected compiler: ${CMAKE_C_COMPILER}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/lib")
|