PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/cmake/Linking.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 65 lines | 47 code | 7 blank | 11 comment | 6 complexity | 7d1f958cdf7b42e740238fc984318394 MD5 | raw file
 1# -*- cmake -*-
 2
 3include(Variables)
 4
 5set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib)
 6set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release)
 7set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug)
 8if (WINDOWS)
 9  set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
10  set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
11elseif (LINUX)
12  set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib)
13  set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin)
14elseif (DARWIN)
15  set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
16  set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)")
17endif (WINDOWS)
18
19# Autobuild packages must provide 'release' versions of libraries, but may provide versions for
20# specific build types.  AUTOBUILD_LIBS_INSTALL_DIRS lists first the build type directory and then
21# the 'release' directory (as a default fallback).
22# *NOTE - we have to take special care to use CMAKE_CFG_INTDIR on IDE generators (like mac and
23# windows) and CMAKE_BUILD_TYPE on Makefile based generators (like linux).  The reason for this is
24# that CMAKE_BUILD_TYPE is essentially meaningless at configuration time for IDE generators and
25# CMAKE_CFG_INTDIR is meaningless at build time for Makefile generators
26if(WINDOWS OR DARWIN)
27  # the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us
28  # fortunately both windows and darwin are case insensitive filesystems so this works.
29  set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/")
30else(WINDOWS OR DARWIN)
31  # else block is for linux and any other makefile based generators
32  string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
33  set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER})
34endif(WINDOWS OR DARWIN)
35
36list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
37link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS})
38
39if (LINUX)
40  set(DL_LIBRARY dl)
41  set(PTHREAD_LIBRARY pthread)
42else (LINUX)
43  set(DL_LIBRARY "")
44  set(PTHREAD_LIBRARY "")
45endif (LINUX)
46
47if (WINDOWS)
48  set(WINDOWS_LIBRARIES
49      advapi32
50      shell32
51      ws2_32
52      mswsock
53      psapi
54      winmm
55      netapi32
56      wldap32
57      gdi32
58      user32
59      dbghelp
60      )
61else (WINDOWS)
62  set(WINDOWS_LIBRARIES "")
63endif (WINDOWS)
64    
65mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES)