summaryrefslogtreecommitdiffstats
path: root/Modules/CheckLibraryExists.cmake
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-24 20:36:56 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-24 20:36:56 (GMT)
commit3697ad6dc75db3b0f66ce9a2c0fba52c1602c4e9 (patch)
tree6b8e7893537774a792a83b287fd0139489cd3e6e /Modules/CheckLibraryExists.cmake
parent8d14221f7e142d558828a7d160566c30dd46baa0 (diff)
downloadCMake-3697ad6dc75db3b0f66ce9a2c0fba52c1602c4e9.zip
CMake-3697ad6dc75db3b0f66ce9a2c0fba52c1602c4e9.tar.gz
CMake-3697ad6dc75db3b0f66ce9a2c0fba52c1602c4e9.tar.bz2
Initial attempt to check if library exists
Diffstat (limited to 'Modules/CheckLibraryExists.cmake')
-rw-r--r--Modules/CheckLibraryExists.cmake27
1 files changed, 27 insertions, 0 deletions
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
new file mode 100644
index 0000000..856840e
--- /dev/null
+++ b/Modules/CheckLibraryExists.cmake
@@ -0,0 +1,27 @@
+#
+# Check if the function exists.
+#
+# CHECK_LIBRARY_EXISTS - macro which checks if the function exists
+# FUNCTION - the name of the function
+# VARIABLE - variable to store the result
+#
+
+MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
+ SET(CHECK_LIBRARY_EXISTS_LIBRARY ${LIBRARY})
+ SET(CHECK_LIBRARY_EXISTS_FUNCTION ${FUNCTION})
+ SET(CHECK_LIBRARY_EXISTS_LOCATION ${LOCATION})
+ SET(CHECK_LIBRARY_EXISTS_VARIABLE ${VARIABLE})
+ SET(CHECK_LIBRARY_EXISTS_SOURCE ${CMAKE_ROOT}/Modules/CheckFunctionExists.c)
+ CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckLibraryExists.lists.in
+ ${PROJECT_BINARY_DIR}/CMakeTmp/CheckLibraryExists/CMakeLists.txt
+ IMMEDIATE)
+ TRY_COMPILE(${VARIABLE}
+ ${PROJECT_BINARY_DIR}/CMakeTmp/CheckLibraryExists
+ ${PROJECT_BINARY_DIR}/CMakeTmp/CheckLibraryExists
+ CHECK_LIBRARY_EXISTS OUTPUT_VARIABLE OUTPUT)
+ IF(NOT ${VARIABLE})
+ WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
+ "Determining if the function ${FUNCTION} exists failed with the following output:\n"
+ "${OUTPUT}\n")
+ ENDIF(NOT ${VARIABLE})
+ENDMACRO(CHECK_LIBRARY_EXISTS)