summaryrefslogtreecommitdiff
path: root/indra/cmake/Linking.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'indra/cmake/Linking.cmake')
-rw-r--r--indra/cmake/Linking.cmake88
1 files changed, 57 insertions, 31 deletions
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index 3cb235a9d5..5a16776e57 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -1,8 +1,6 @@
# -*- cmake -*-
-if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
-set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
-
+include_guard()
include(Variables)
set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib)
@@ -18,6 +16,11 @@ elseif (LINUX)
elseif (DARWIN)
set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs")
+ if( ${CMAKE_GENERATOR} STREQUAL "Ninja")
+ set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/${CMAKE_BUILD_TYPE} ")
+ else()
+ set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs")
+ endif()
endif (WINDOWS)
# Autobuild packages must provide 'release' versions of libraries, but may provide versions for
@@ -30,7 +33,13 @@ endif (WINDOWS)
if(WINDOWS OR DARWIN)
# the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us
# fortunately both windows and darwin are case insensitive filesystems so this works.
- set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/")
+ # Ninja on the other hand needs the the full path
+ if( ${CMAKE_GENERATOR} STREQUAL "Ninja")
+ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
+ set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER})
+ else()
+ set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/")
+ endif()
else(WINDOWS OR DARWIN)
# else block is for linux and any other makefile based generators
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
@@ -46,33 +55,50 @@ endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS})
+add_library( ll::oslibraries INTERFACE IMPORTED )
+
if (LINUX)
- set(DL_LIBRARY dl)
- set(PTHREAD_LIBRARY pthread)
-else (LINUX)
- set(DL_LIBRARY "")
- set(PTHREAD_LIBRARY "")
-endif (LINUX)
+ target_link_libraries( ll::oslibraries INTERFACE
+ dl
+ pthread
+ rt)
+elseif (WINDOWS)
+ target_link_libraries( ll::oslibraries INTERFACE
+ advapi32
+ shell32
+ ws2_32
+ mswsock
+ psapi
+ winmm
+ netapi32
+ wldap32
+ gdi32
+ user32
+ ole32
+ dbghelp
+ legacy_stdio_definitions
+ )
+else()
+ include(CMakeFindFrameworks)
+ find_library(COREFOUNDATION_LIBRARY CoreFoundation)
+ find_library(CARBON_LIBRARY Carbon)
+ find_library(COCOA_LIBRARY Cocoa)
+ find_library(IOKIT_LIBRARY IOKit)
+
+ find_library(AGL_LIBRARY AGL)
+ find_library(APPKIT_LIBRARY AppKit)
+ find_library(COREAUDIO_LIBRARY CoreAudio)
+
+ target_link_libraries( ll::oslibraries INTERFACE
+ ${COCOA_LIBRARY}
+ ${IOKIT_LIBRARY}
+ ${COREFOUNDATION_LIBRARY}
+ ${CARBON_LIBRARY}
+ ${AGL_LIBRARY}
+ ${APPKIT_LIBRARY}
+ ${COREAUDIO_LIBRARY}
+ )
+endif()
+
-if (WINDOWS)
- set(WINDOWS_LIBRARIES
- advapi32
- shell32
- ws2_32
- mswsock
- psapi
- winmm
- netapi32
- wldap32
- gdi32
- user32
- ole32
- dbghelp
- )
-else (WINDOWS)
- set(WINDOWS_LIBRARIES "")
-endif (WINDOWS)
-
-mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES)
-endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)