summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2015-02-05 04:46:38 +0000
committerStephen D. Huston <shuston@apache.org>2015-02-05 04:46:38 +0000
commit8ac45d6689d42d6773be8ba8b3d9f1b99c3905f3 (patch)
tree3013d3fda10eea4d1cd7a88489e2b352ca3926c4 /qpid/cpp
parent43bba6aff5eb4ebbe3630d21fadb46cd32727535 (diff)
downloadqpid-python-8ac45d6689d42d6773be8ba8b3d9f1b99c3905f3.tar.gz
Add cmake module for checking size_t native; should have been with the rest of the patch for QPID-6312
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1657476 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/CMakeModules/CheckSizeTNativeType.cmake59
1 files changed, 59 insertions, 0 deletions
diff --git a/qpid/cpp/CMakeModules/CheckSizeTNativeType.cmake b/qpid/cpp/CMakeModules/CheckSizeTNativeType.cmake
new file mode 100644
index 0000000000..fb515cd149
--- /dev/null
+++ b/qpid/cpp/CMakeModules/CheckSizeTNativeType.cmake
@@ -0,0 +1,59 @@
+#
+# $Id $
+#
+# Author(s): Anton Deguet
+# Created on: 2011
+#
+# (C) Copyright 2011 Johns Hopkins University (JHU), All Rights
+# Reserved.
+#
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with
+# no warranty. The complete license can be found in license.txt and
+# http://www.cisst.org/cisst/license.txt.
+#
+# --- end cisst license ---
+
+function (check_size_t_native_type VARIABLE)
+ # make sure we don't test over and over
+ if ("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ message (STATUS "Checking to see if size_t is a native type")
+ set (SOURCE
+ "#include <vector>
+ char method(unsigned int p) {
+ return 'u';
+ }
+ char method(unsigned long long int p) {
+ return 'l';
+ }
+ char method(size_t p) {
+ return 's';
+ }
+ int main(void) {}")
+
+ file (WRITE
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_size_t.cpp"
+ "${SOURCE}\n")
+
+ try_compile (${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_size_t.cpp"
+ OUTPUT_VARIABLE OUTPUT)
+
+ # report using message and log files
+ if (${VARIABLE})
+ message (STATUS "Checking to see if size_t is a native type - yes")
+ file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if size_t is a native type passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ else (${VARIABLE})
+ message (STATUS "Checking to see if size_t is a native type - no")
+ file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if size_t is a native type passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ endif (${VARIABLE})
+
+ endif ("${VARIABLE}" MATCHES "^${VARIABLE}$")
+
+endfunction (check_size_t_native_type VARIABLE)