cmake: Default to RelWithDebugInfo.
[vlc.git] / extras / buildsystem / cmake / include / FindDlopen.cmake
1 # From licq www.licq.org (GPL)
2 # - Find library containing dlopen()
3 # The following variables are set if dlopen is found. If dlopen is not
4 # found, Dlopen_FOUND is set to false.
5 #  Dlopen_FOUND     - System has dlopen.
6 #  Dlopen_LIBRARIES - Link these to use dlopen.
7 #
8 # Copyright (c) 2007 Erik Johansson <erik@ejohansson.se>
9 # Redistribution and use is allowed according to the terms of the BSD license.
10
11
12 if (NOT Dlopen_SEARCHED)
13     include(CheckLibraryExists)
14
15     set(Dlopen_SEARCHED TRUE CACHE INTERNAL "")
16     set(Dlopen_FOUND FALSE CACHE INTERNAL "")
17
18     foreach (library c c_r dl)
19       if (NOT Dlopen_FOUND)
20         check_library_exists(${library} dlopen "" Dlopen_IN_${library})
21
22         if (Dlopen_IN_${library})
23           set(Dlopen_LIBRARIES ${library} CACHE STRING "Library containing dlopen")
24           set(Dlopen_FOUND TRUE CACHE INTERNAL "")
25         endif (Dlopen_IN_${library})
26
27       endif (NOT Dlopen_FOUND)
28     endforeach (library)
29
30     if (Dlopen_FOUND)
31       if (NOT Dlopen_FIND_QUIETLY)
32         message(STATUS "Found dlopen in: ${Dlopen_LIBRARIES}")
33       endif (NOT Dlopen_FIND_QUIETLY)
34     else (Dlopen_FOUND)
35       if (Dlopen_FIND_REQUIRED)
36         message(FATAL_ERROR "Could not find the library containing dlopen")
37       endif (Dlopen_FIND_REQUIRED)
38     endif (Dlopen_FOUND)
39
40     mark_as_advanced(Dlopen_LIBRARIES)
41 endif(NOT Dlopen_SEARCHED)