summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-08-01 03:02:22 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-08-01 03:02:22 (GMT)
commite898324778c5f46d264a1351992be5d0c0d11eae (patch)
treeabdcec4b00849077861950b881f9ffe67b4ad31f /Tests
parentefc41c634cecd30de5396d00f18d5f9f780f41c6 (diff)
downloadCMake-e898324778c5f46d264a1351992be5d0c0d11eae.zip
CMake-e898324778c5f46d264a1351992be5d0c0d11eae.tar.gz
CMake-e898324778c5f46d264a1351992be5d0c0d11eae.tar.bz2
ENH: Add a test for C source file like AC_TRY_COMPILE
Diffstat (limited to 'Tests')
-rw-r--r--Tests/MacroTest/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt
index 8e5a5e9..604467c 100644
--- a/Tests/MacroTest/CMakeLists.txt
+++ b/Tests/MacroTest/CMakeLists.txt
@@ -47,4 +47,26 @@ ENDIF("${var}" EQUAL "strange_macro" AND "${second_var}" EQUAL "second_var")
MACRO(ADD_EXECUTABLE exec)
_ADD_EXECUTABLE("mini${exec}" ${ARGN})
ENDMACRO(ADD_EXECUTABLE)
+
+INCLUDE(CheckCSourceCompiles)
+Check_C_Source_Compiles(
+"
+#include <stdio.h>
+#ifdef __CLASSIC_C__
+int main(){
+ int ac;
+ char*av[];
+#else
+int main(int ac, char*av[]){
+#endif
+ if(ac > 1000){return *av[0];}
+ return 0;
+}"
+SOME_CHECK)
+IF(SOME_CHECK)
+ MESSAGE("CheckCSourceCompiles works")
+ELSE(SOME_CHECK)
+ MESSAGE(FATAL_ERROR "CheckCSourceCompiles does not work")
+ENDIF(SOME_CHECK)
+
ADD_EXECUTABLE(MacroTest macroTest.c)