Commit 433173d9 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

FindDlopen.cmake: Don't run the FindDlopen module more than once.

parent 2c86b239
...@@ -8,31 +8,35 @@ ...@@ -8,31 +8,35 @@
# Copyright (c) 2007 Erik Johansson <erik@ejohansson.se> # Copyright (c) 2007 Erik Johansson <erik@ejohansson.se>
# Redistribution and use is allowed according to the terms of the BSD license. # Redistribution and use is allowed according to the terms of the BSD license.
include(CheckLibraryExists)
# Assume dlopen is not found. # Assume dlopen is not found.
set(Dlopen_FOUND FALSE) if (Dlopen_SEARCHED)
include(CheckLibraryExists)
foreach (library c c_r dl)
if (NOT Dlopen_FOUND) set(Dlopen_SEARCHED TRUE)
check_library_exists(${library} dlopen "" Dlopen_IN_${library}) set(Dlopen_FOUND FALSE)
if (Dlopen_IN_${library}) foreach (library c c_r dl)
set(Dlopen_LIBRARIES ${library} CACHE STRING "Library containing dlopen") if (NOT Dlopen_FOUND)
set(Dlopen_FOUND TRUE) check_library_exists(${library} dlopen "" Dlopen_IN_${library})
endif (Dlopen_IN_${library})
if (Dlopen_IN_${library})
endif (NOT Dlopen_FOUND) set(Dlopen_LIBRARIES ${library} CACHE STRING "Library containing dlopen")
endforeach (library) set(Dlopen_FOUND TRUE)
endif (Dlopen_IN_${library})
if (Dlopen_FOUND)
if (NOT Dlopen_FIND_QUIETLY) endif (NOT Dlopen_FOUND)
message(STATUS "Found dlopen in: ${Dlopen_LIBRARIES}") endforeach (library)
endif (NOT Dlopen_FIND_QUIETLY)
else (Dlopen_FOUND) if (Dlopen_FOUND)
if (Dlopen_FIND_REQUIRED) if (NOT Dlopen_FIND_QUIETLY)
message(FATAL_ERROR "Could not find the library containing dlopen") message(STATUS "Found dlopen in: ${Dlopen_LIBRARIES}")
endif (Dlopen_FIND_REQUIRED) endif (NOT Dlopen_FIND_QUIETLY)
endif (Dlopen_FOUND) else (Dlopen_FOUND)
if (Dlopen_FIND_REQUIRED)
mark_as_advanced(Dlopen_LIBRARIES) message(FATAL_ERROR "Could not find the library containing dlopen")
endif (Dlopen_FIND_REQUIRED)
endif (Dlopen_FOUND)
mark_as_advanced(Dlopen_LIBRARIES)
endif(Dlopen_SEARCHED)
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment