From 50423a779e771f284fa19d28c205ade881f7c3aa Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Fri, 20 Sep 2002 13:17:59 -0400 Subject: [PATCH] Fix test so that it does some modules testing by checking for some functions and some size of types --- Tests/LoadCommand/CMakeLists.txt | 19 ++++++++++++++++++- Tests/LoadCommand/LoadedCommand.cxx | 6 ++++-- Tests/LoadCommand/LoadedCommand.h.in | 11 +++++++++++ Tests/LoadCommandOneConfig/CMakeLists.txt | 19 ++++++++++++++++++- Tests/LoadCommandOneConfig/LoadedCommand.cxx | 6 ++++-- Tests/LoadCommandOneConfig/LoadedCommand.h.in | 11 +++++++++++ 6 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 Tests/LoadCommand/LoadedCommand.h.in create mode 100644 Tests/LoadCommandOneConfig/LoadedCommand.h.in diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index 793589ad3..fa9e5acf2 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -3,6 +3,24 @@ PROJECT(LoadedCommand) # set a definition SET (TEST_COMMAND_TEST1 1) +INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake) +CHECK_TYPE_SIZE(char SIZEOF_CHAR) +CHECK_TYPE_SIZE(short SIZEOF_SHORT) +CHECK_TYPE_SIZE(int SIZEOF_INT) +CHECK_TYPE_SIZE(long SIZEOF_LONG) +CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) +CHECK_TYPE_SIZE(__int64 SIZEOF___INT64) + +INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) +CHECK_FUNCTION_EXISTS(vsprintf HAVE_VSPRINTF) +CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF) +CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) + +CONFIGURE_FILE(${LoadedCommand_SOURCE_DIR}/LoadedCommand.h.in + ${LoadedCommand_BINARY_DIR}/LoadedCommand.h) + +INCLUDE_DIRECTORIES(${LoadedCommand_BINARY_DIR}) + # try to compile the command TRY_COMPILE(COMPILE_OK ${LoadedCommand_BINARY_DIR}/CMakeCommands @@ -28,4 +46,3 @@ IF (TEST_DEF) ENDIF (TEST_DEF) ADD_EXECUTABLE (LoadedCommand LoadedCommand.cxx) - diff --git a/Tests/LoadCommand/LoadedCommand.cxx b/Tests/LoadCommand/LoadedCommand.cxx index c2a3439a0..65483c87f 100644 --- a/Tests/LoadCommand/LoadedCommand.cxx +++ b/Tests/LoadCommand/LoadedCommand.cxx @@ -1,8 +1,10 @@ +#include "LoadedCommand.h" + int main () { #ifdef CMAKE_IS_FUN - return 0; + return SIZEOF_CHAR-1; #else - return 1; + return SIZEOF_SHORT; #endif } diff --git a/Tests/LoadCommand/LoadedCommand.h.in b/Tests/LoadCommand/LoadedCommand.h.in new file mode 100644 index 000000000..7b210f871 --- /dev/null +++ b/Tests/LoadCommand/LoadedCommand.h.in @@ -0,0 +1,11 @@ +#cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR} +#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} +#cmakedefine SIZEOF_INT ${SIZEOF_INT} +#cmakedefine SIZEOF_LONG ${SIZEOF_LONG} +#cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG} +#cmakedefine SIZEOF___INT64 ${SIZEOF___INT64} + +#cmakedefine HAVE_VSPRINTF +#cmakedefine HAVE_VSNPRINTF +#cmakedefine HAVE_VSBLABLA + diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt index 793589ad3..fa9e5acf2 100644 --- a/Tests/LoadCommandOneConfig/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeLists.txt @@ -3,6 +3,24 @@ PROJECT(LoadedCommand) # set a definition SET (TEST_COMMAND_TEST1 1) +INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake) +CHECK_TYPE_SIZE(char SIZEOF_CHAR) +CHECK_TYPE_SIZE(short SIZEOF_SHORT) +CHECK_TYPE_SIZE(int SIZEOF_INT) +CHECK_TYPE_SIZE(long SIZEOF_LONG) +CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) +CHECK_TYPE_SIZE(__int64 SIZEOF___INT64) + +INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) +CHECK_FUNCTION_EXISTS(vsprintf HAVE_VSPRINTF) +CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF) +CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) + +CONFIGURE_FILE(${LoadedCommand_SOURCE_DIR}/LoadedCommand.h.in + ${LoadedCommand_BINARY_DIR}/LoadedCommand.h) + +INCLUDE_DIRECTORIES(${LoadedCommand_BINARY_DIR}) + # try to compile the command TRY_COMPILE(COMPILE_OK ${LoadedCommand_BINARY_DIR}/CMakeCommands @@ -28,4 +46,3 @@ IF (TEST_DEF) ENDIF (TEST_DEF) ADD_EXECUTABLE (LoadedCommand LoadedCommand.cxx) - diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.cxx b/Tests/LoadCommandOneConfig/LoadedCommand.cxx index c2a3439a0..65483c87f 100644 --- a/Tests/LoadCommandOneConfig/LoadedCommand.cxx +++ b/Tests/LoadCommandOneConfig/LoadedCommand.cxx @@ -1,8 +1,10 @@ +#include "LoadedCommand.h" + int main () { #ifdef CMAKE_IS_FUN - return 0; + return SIZEOF_CHAR-1; #else - return 1; + return SIZEOF_SHORT; #endif } diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.h.in b/Tests/LoadCommandOneConfig/LoadedCommand.h.in new file mode 100644 index 000000000..7b210f871 --- /dev/null +++ b/Tests/LoadCommandOneConfig/LoadedCommand.h.in @@ -0,0 +1,11 @@ +#cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR} +#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} +#cmakedefine SIZEOF_INT ${SIZEOF_INT} +#cmakedefine SIZEOF_LONG ${SIZEOF_LONG} +#cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG} +#cmakedefine SIZEOF___INT64 ${SIZEOF___INT64} + +#cmakedefine HAVE_VSPRINTF +#cmakedefine HAVE_VSNPRINTF +#cmakedefine HAVE_VSBLABLA +