summaryrefslogtreecommitdiff
path: root/cmake/EnsureFileInclude.cmake
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2013-03-13 15:21:20 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2013-03-13 15:21:20 +0000
commit6de2271e2a3a5489399302c992b53ab2a0f01a8c (patch)
treed48382067b00460ffae03034ba75365b9d443004 /cmake/EnsureFileInclude.cmake
parent021e25528220d25a1d933bcc0eea1bf5abac87e9 (diff)
[trunk] use the home made macro to ensure the existence of some include file
Diffstat (limited to 'cmake/EnsureFileInclude.cmake')
-rw-r--r--cmake/EnsureFileInclude.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/EnsureFileInclude.cmake b/cmake/EnsureFileInclude.cmake
new file mode 100644
index 00000000..e173ea1a
--- /dev/null
+++ b/cmake/EnsureFileInclude.cmake
@@ -0,0 +1,26 @@
+# Ensure that an include file is provided by the system
+# Add the check about the mandatory status to the check_include_file macro
+# provided by cmake
+
+include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+
+macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
+
+#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
+# "VARIABLE_NAME=${VARIABLE_NAME} \n"
+# "MANDATORY_STATUS=${MANDATORY_STATUS}")
+
+CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME})
+
+#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
+# "VARIABLE_NAME=${VARIABLE_NAME} \n"
+# "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n"
+# "MANDATORY_STATUS=${MANDATORY_STATUS}")
+
+if (NOT ${${VARIABLE_NAME}})
+ if (${MANDATORY_STATUS})
+ message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system")
+ endif()
+endif()
+
+endmacro() \ No newline at end of file